m.smali
.class public final Lcom/baidu/sofire/i/m;
.super Ljava/lang/Object;
.source "HttpUtil.java"
# annotations
.annotation build Landroid/annotation/SuppressLint;
value = {
"NewApi"
}
.end annotation
.annotation system Ldalvik/annotation/MemberClasses;
value = {
Lcom/baidu/sofire/i/m$a;
}
.end annotation
# static fields
.field private static h:Ljavax/net/ssl/SSLSocketFactory;
# instance fields
.field a:Landroid/content/Context;
.field b:[B
.field private c:Ljava/lang/String;
.field private d:Ljava/lang/String;
.field private e:I
.field private f:I
.field private g:Z
# direct methods
.method public constructor <init>(Landroid/content/Context;)V
.registers 4
.prologue
const v1, 0x1d4c0
.line 62
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 53
const/16 v0, 0x2000
new-array v0, v0, [B
iput-object v0, p0, Lcom/baidu/sofire/i/m;->b:[B
.line 57
iput v1, p0, Lcom/baidu/sofire/i/m;->e:I
.line 58
iput v1, p0, Lcom/baidu/sofire/i/m;->f:I
.line 59
const/4 v0, 0x0
iput-boolean v0, p0, Lcom/baidu/sofire/i/m;->g:Z
.line 63
iput-object p1, p0, Lcom/baidu/sofire/i/m;->a:Landroid/content/Context;
.line 64
return-void
.end method
.method private a(Ljava/net/HttpURLConnection;)Ljava/io/InputStream;
.registers 5
.prologue
const/4 v0, 0x0
.line 282
iget-object v1, p0, Lcom/baidu/sofire/i/m;->a:Landroid/content/Context;
invoke-static {v1}, Lcom/baidu/sofire/i/d;->f(Landroid/content/Context;)Z
move-result v1
if-nez v1, :cond_a
.line 303
:cond_9
:goto_9
return-object v0
.line 286
:cond_a
if-eqz p1, :cond_9
.line 291
if-eqz p1, :cond_9
.line 293
:try_start_e
const-string v1, "gzip"
invoke-virtual {p1}, Ljava/net/HttpURLConnection;->getContentEncoding()Ljava/lang/String;
move-result-object v2
invoke-virtual {v1, v2}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
move-result v1
if-eqz v1, :cond_22
.line 294
const/4 v1, 0x1
iput-boolean v1, p0, Lcom/baidu/sofire/i/m;->g:Z
.line 298
:goto_1d
invoke-virtual {p1}, Ljava/net/HttpURLConnection;->getInputStream()Ljava/io/InputStream;
move-result-object v0
goto :goto_9
.line 296
:cond_22
const/4 v1, 0x0
iput-boolean v1, p0, Lcom/baidu/sofire/i/m;->g:Z
:try_end_25
.catch Ljava/io/IOException; {:try_start_e .. :try_end_25} :catch_26
goto :goto_1d
.line 301
:catch_26
move-exception v1
invoke-static {}, Lcom/baidu/sofire/i/d;->a()V
goto :goto_9
.end method
.method private a([BLjava/net/HttpURLConnection;)Ljava/io/InputStream;
.registers 8
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;,
Landroid/accounts/NetworkErrorException;
}
.end annotation
.prologue
const/4 v0, 0x0
const/16 v3, 0xc8
.line 222
if-nez p2, :cond_6
.line 257
:goto_5
return-object v0
.line 227
:cond_6
if-nez p1, :cond_47
.line 228
:try_start_8
invoke-virtual {p2}, Ljava/net/HttpURLConnection;->getResponseCode()I
move-result v1
.line 229
if-eq v1, v3, :cond_24
.line 230
new-instance v2, Landroid/accounts/NetworkErrorException;
invoke-static {v1}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;
move-result-object v1
invoke-direct {v2, v1}, Landroid/accounts/NetworkErrorException;-><init>(Ljava/lang/String;)V
throw v2
:try_end_18
.catch Ljava/io/IOException; {:try_start_8 .. :try_end_18} :catch_18
.catch Landroid/accounts/NetworkErrorException; {:try_start_8 .. :try_end_18} :catch_42
.catch Ljava/lang/Throwable; {:try_start_8 .. :try_end_18} :catch_87
.catchall {:try_start_8 .. :try_end_18} :catchall_98
.line 259
:catch_18
move-exception v1
move-object v4, v1
move-object v1, v0
move-object v0, v4
:goto_1c
:try_start_1c
throw v0
:try_end_1d
.catchall {:try_start_1c .. :try_end_1d} :catchall_1d
.line 266
:catchall_1d
move-exception v0
.line 267
:goto_1e
if-eqz v1, :cond_23
.line 268
:try_start_20
invoke-virtual {v1}, Ljava/io/BufferedOutputStream;->close()V
:try_end_23
.catch Ljava/lang/Throwable; {:try_start_20 .. :try_end_23} :catch_96
.line 272
:cond_23
:goto_23
throw v0
.line 232
:cond_24
:try_start_24
invoke-virtual {p2}, Ljava/net/HttpURLConnection;->getContentEncoding()Ljava/lang/String;
move-result-object v1
.line 233
invoke-static {v1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
move-result v2
if-nez v2, :cond_3e
const-string v2, "gzip"
.line 234
invoke-virtual {v2, v1}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
move-result v1
if-eqz v1, :cond_3e
.line 235
const/4 v1, 0x1
iput-boolean v1, p0, Lcom/baidu/sofire/i/m;->g:Z
.line 239
:goto_39
invoke-virtual {p2}, Ljava/net/HttpURLConnection;->getInputStream()Ljava/io/InputStream;
move-result-object v0
goto :goto_5
.line 237
:cond_3e
const/4 v1, 0x0
iput-boolean v1, p0, Lcom/baidu/sofire/i/m;->g:Z
:try_end_41
.catch Ljava/io/IOException; {:try_start_24 .. :try_end_41} :catch_18
.catch Landroid/accounts/NetworkErrorException; {:try_start_24 .. :try_end_41} :catch_42
.catch Ljava/lang/Throwable; {:try_start_24 .. :try_end_41} :catch_87
.catchall {:try_start_24 .. :try_end_41} :catchall_98
goto :goto_39
.line 261
:catch_42
move-exception v1
move-object v4, v1
move-object v1, v0
move-object v0, v4
:goto_46
:try_start_46
throw v0
:try_end_47
.catchall {:try_start_46 .. :try_end_47} :catchall_1d
.line 242
:cond_47
:try_start_47
new-instance v1, Ljava/io/BufferedOutputStream;
invoke-virtual {p2}, Ljava/net/HttpURLConnection;->getOutputStream()Ljava/io/OutputStream;
move-result-object v2
invoke-direct {v1, v2}, Ljava/io/BufferedOutputStream;-><init>(Ljava/io/OutputStream;)V
:try_end_50
.catch Ljava/io/IOException; {:try_start_47 .. :try_end_50} :catch_18
.catch Landroid/accounts/NetworkErrorException; {:try_start_47 .. :try_end_50} :catch_42
.catch Ljava/lang/Throwable; {:try_start_47 .. :try_end_50} :catch_87
.catchall {:try_start_47 .. :try_end_50} :catchall_98
.line 244
:try_start_50
invoke-virtual {v1, p1}, Ljava/io/BufferedOutputStream;->write([B)V
.line 245
invoke-virtual {v1}, Ljava/io/BufferedOutputStream;->flush()V
.line 247
invoke-virtual {p2}, Ljava/net/HttpURLConnection;->getResponseCode()I
move-result v0
.line 248
if-eq v0, v3, :cond_68
.line 249
new-instance v2, Landroid/accounts/NetworkErrorException;
invoke-static {v0}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;
move-result-object v0
invoke-direct {v2, v0}, Landroid/accounts/NetworkErrorException;-><init>(Ljava/lang/String;)V
throw v2
.line 259
:catch_66
move-exception v0
goto :goto_1c
.line 252
:cond_68
const-string v0, "gzip"
invoke-virtual {p2}, Ljava/net/HttpURLConnection;->getContentEncoding()Ljava/lang/String;
move-result-object v2
invoke-virtual {v0, v2}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
move-result v0
if-eqz v0, :cond_81
.line 253
const/4 v0, 0x1
iput-boolean v0, p0, Lcom/baidu/sofire/i/m;->g:Z
.line 257
:goto_77
invoke-virtual {p2}, Ljava/net/HttpURLConnection;->getInputStream()Ljava/io/InputStream;
:try_end_7a
.catch Ljava/io/IOException; {:try_start_50 .. :try_end_7a} :catch_66
.catch Landroid/accounts/NetworkErrorException; {:try_start_50 .. :try_end_7a} :catch_85
.catch Ljava/lang/Throwable; {:try_start_50 .. :try_end_7a} :catch_9d
.catchall {:try_start_50 .. :try_end_7a} :catchall_1d
move-result-object v0
.line 268
:try_start_7b
invoke-virtual {v1}, Ljava/io/BufferedOutputStream;->close()V
:try_end_7e
.catch Ljava/lang/Throwable; {:try_start_7b .. :try_end_7e} :catch_7f
goto :goto_5
:catch_7f
move-exception v1
goto :goto_5
.line 255
:cond_81
const/4 v0, 0x0
:try_start_82
iput-boolean v0, p0, Lcom/baidu/sofire/i/m;->g:Z
:try_end_84
.catch Ljava/io/IOException; {:try_start_82 .. :try_end_84} :catch_66
.catch Landroid/accounts/NetworkErrorException; {:try_start_82 .. :try_end_84} :catch_85
.catch Ljava/lang/Throwable; {:try_start_82 .. :try_end_84} :catch_9d
.catchall {:try_start_82 .. :try_end_84} :catchall_1d
goto :goto_77
.line 261
:catch_85
move-exception v0
goto :goto_46
.line 263
:catch_87
move-exception v1
:goto_88
:try_start_88
invoke-static {}, Lcom/baidu/sofire/i/d;->a()V
.line 264
new-instance v1, Ljava/io/IOException;
invoke-direct {v1}, Ljava/io/IOException;-><init>()V
throw v1
:try_end_91
.catchall {:try_start_88 .. :try_end_91} :catchall_91
.line 266
:catchall_91
move-exception v1
move-object v4, v1
move-object v1, v0
move-object v0, v4
goto :goto_1e
:catch_96
move-exception v1
goto :goto_23
:catchall_98
move-exception v1
move-object v4, v1
move-object v1, v0
move-object v0, v4
goto :goto_1e
.line 263
:catch_9d
move-exception v0
move-object v0, v1
goto :goto_88
.end method
.method private a(Ljava/io/InputStream;)Ljava/lang/String;
.registers 5
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;,
Ljava/lang/InterruptedException;
}
.end annotation
.prologue
.line 316
if-nez p1, :cond_a
.line 317
new-instance v0, Ljava/io/IOException;
const-string v1, "InputStream"
invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
throw v0
.line 321
:cond_a
:try_start_a
invoke-static {p1}, Lcom/baidu/sofire/i/m;->b(Ljava/io/InputStream;)[B
move-result-object v0
.line 322
if-nez v0, :cond_22
.line 323
new-instance v0, Ljava/io/IOException;
const-string v1, "responseBytes"
invoke-direct {v0, v1}, Ljava/io/IOException;-><init>(Ljava/lang/String;)V
throw v0
:try_end_18
.catch Ljava/lang/Throwable; {:try_start_a .. :try_end_18} :catch_18
.line 334
:catch_18
move-exception v0
invoke-static {}, Lcom/baidu/sofire/i/d;->a()V
.line 335
new-instance v0, Ljava/io/IOException;
invoke-direct {v0}, Ljava/io/IOException;-><init>()V
throw v0
.line 325
:cond_22
:try_start_22
iget-boolean v1, p0, Lcom/baidu/sofire/i/m;->g:Z
if-eqz v1, :cond_40
.line 2043
new-instance v1, Ljava/io/ByteArrayInputStream;
invoke-direct {v1, v0}, Ljava/io/ByteArrayInputStream;-><init>([B)V
.line 2044
new-instance v2, Ljava/io/ByteArrayOutputStream;
invoke-direct {v2}, Ljava/io/ByteArrayOutputStream;-><init>()V
.line 2046
invoke-static {v1, v2}, Lcom/baidu/sofire/i/j;->b(Ljava/io/InputStream;Ljava/io/OutputStream;)V
.line 2047
invoke-virtual {v2}, Ljava/io/ByteArrayOutputStream;->toByteArray()[B
move-result-object v0
.line 2048
invoke-virtual {v2}, Ljava/io/ByteArrayOutputStream;->flush()V
.line 2049
invoke-virtual {v2}, Ljava/io/ByteArrayOutputStream;->close()V
.line 2050
invoke-virtual {v1}, Ljava/io/ByteArrayInputStream;->close()V
.line 328
:cond_40
if-eqz v0, :cond_48
.line 329
new-instance v1, Ljava/lang/String;
invoke-direct {v1, v0}, Ljava/lang/String;-><init>([B)V
return-object v1
.line 331
:cond_48
new-instance v0, Ljava/io/IOException;
invoke-direct {v0}, Ljava/io/IOException;-><init>()V
throw v0
:try_end_4e
.catch Ljava/lang/Throwable; {:try_start_22 .. :try_end_4e} :catch_18
.end method
.method private a()Ljava/net/HttpURLConnection;
.registers 12
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.prologue
const/4 v0, -0x1
const/4 v1, 0x0
const/4 v10, 0x1
const/4 v3, 0x0
.line 135
iget-object v2, p0, Lcom/baidu/sofire/i/m;->c:Ljava/lang/String;
invoke-static {v2}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
move-result v2
if-nez v2, :cond_14
iget-object v2, p0, Lcom/baidu/sofire/i/m;->d:Ljava/lang/String;
invoke-static {v2}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
move-result v2
if-eqz v2, :cond_1a
.line 136
:cond_14
new-instance v0, Ljava/lang/IllegalArgumentException;
invoke-direct {v0}, Ljava/lang/IllegalArgumentException;-><init>()V
throw v0
.line 138
:cond_1a
iget-object v2, p0, Lcom/baidu/sofire/i/m;->c:Ljava/lang/String;
const-string v4, "POST"
invoke-virtual {v2, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v2
if-nez v2, :cond_32
iget-object v2, p0, Lcom/baidu/sofire/i/m;->c:Ljava/lang/String;
const-string v4, "GET"
invoke-virtual {v2, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v2
if-nez v2, :cond_32
.line 139
const-string v2, "POST"
iput-object v2, p0, Lcom/baidu/sofire/i/m;->c:Ljava/lang/String;
.line 142
:cond_32
new-instance v2, Ljava/net/URL;
iget-object v4, p0, Lcom/baidu/sofire/i/m;->d:Ljava/lang/String;
invoke-direct {v2, v4}, Ljava/net/URL;-><init>(Ljava/lang/String;)V
.line 148
iget-object v4, p0, Lcom/baidu/sofire/i/m;->a:Landroid/content/Context;
invoke-static {v4}, Lcom/baidu/sofire/i/d;->e(Landroid/content/Context;)Z
move-result v4
if-nez v4, :cond_1d4
.line 149
sget v1, Landroid/os/Build$VERSION;->SDK_INT:I
const/16 v4, 0xd
if-lt v1, v4, :cond_150
.line 150
invoke-static {}, Ljava/lang/System;->getProperties()Ljava/util/Properties;
move-result-object v1
const-string v4, "http.proxyHost"
invoke-virtual {v1, v4}, Ljava/util/Properties;->getProperty(Ljava/lang/String;)Ljava/lang/String;
move-result-object v1
.line 151
invoke-static {}, Ljava/lang/System;->getProperties()Ljava/util/Properties;
move-result-object v4
const-string v5, "http.proxyPort"
invoke-virtual {v4, v5}, Ljava/util/Properties;->getProperty(Ljava/lang/String;)Ljava/lang/String;
move-result-object v4
.line 152
invoke-static {v4}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
move-result v5
if-eqz v5, :cond_14a
.line 167
:goto_61
if-eqz v1, :cond_15e
if-lez v0, :cond_15e
.line 168
invoke-static {v1, v0}, Ljava/net/InetSocketAddress;->createUnresolved(Ljava/lang/String;I)Ljava/net/InetSocketAddress;
move-result-object v0
.line 169
new-instance v1, Ljava/net/Proxy;
sget-object v4, Ljava/net/Proxy$Type;->HTTP:Ljava/net/Proxy$Type;
invoke-direct {v1, v4, v0}, Ljava/net/Proxy;-><init>(Ljava/net/Proxy$Type;Ljava/net/SocketAddress;)V
.line 171
invoke-virtual {v2, v1}, Ljava/net/URL;->openConnection(Ljava/net/Proxy;)Ljava/net/URLConnection;
move-result-object v0
check-cast v0, Ljava/net/HttpURLConnection;
move-object v1, v0
.line 176
:goto_77
const-string v0, "https"
invoke-virtual {v2}, Ljava/net/URL;->getProtocol()Ljava/lang/String;
move-result-object v2
invoke-virtual {v0, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_94
move-object v0, v1
.line 177
check-cast v0, Ljavax/net/ssl/HttpsURLConnection;
.line 1099
:try_start_86
sget-object v2, Lcom/baidu/sofire/i/m;->h:Ljavax/net/ssl/SSLSocketFactory;
if-eqz v2, :cond_167
.line 1100
sget-object v2, Lorg/apache/http/conn/ssl/SSLSocketFactory;->STRICT_HOSTNAME_VERIFIER:Lorg/apache/http/conn/ssl/X509HostnameVerifier;
invoke-virtual {v0, v2}, Ljavax/net/ssl/HttpsURLConnection;->setHostnameVerifier(Ljavax/net/ssl/HostnameVerifier;)V
.line 1101
sget-object v2, Lcom/baidu/sofire/i/m;->h:Ljavax/net/ssl/SSLSocketFactory;
invoke-virtual {v0, v2}, Ljavax/net/ssl/HttpsURLConnection;->setSSLSocketFactory(Ljavax/net/ssl/SSLSocketFactory;)V
:try_end_94
.catch Ljava/lang/Throwable; {:try_start_86 .. :try_end_94} :catch_1a0
.line 179
:cond_94
:goto_94
iget-object v0, p0, Lcom/baidu/sofire/i/m;->c:Ljava/lang/String;
invoke-virtual {v1, v0}, Ljava/net/HttpURLConnection;->setRequestMethod(Ljava/lang/String;)V
.line 180
invoke-virtual {v1, v10}, Ljava/net/HttpURLConnection;->setDoInput(Z)V
.line 182
const-string v0, "POST"
iget-object v2, p0, Lcom/baidu/sofire/i/m;->c:Ljava/lang/String;
invoke-virtual {v0, v2}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z
move-result v0
if-eqz v0, :cond_a9
.line 183
invoke-virtual {v1, v10}, Ljava/net/HttpURLConnection;->setDoOutput(Z)V
.line 186
:cond_a9
invoke-virtual {v1, v10}, Ljava/net/HttpURLConnection;->setInstanceFollowRedirects(Z)V
.line 187
iget v0, p0, Lcom/baidu/sofire/i/m;->e:I
invoke-virtual {v1, v0}, Ljava/net/HttpURLConnection;->setConnectTimeout(I)V
.line 188
iget v0, p0, Lcom/baidu/sofire/i/m;->f:I
invoke-virtual {v1, v0}, Ljava/net/HttpURLConnection;->setReadTimeout(I)V
.line 191
iget-object v0, p0, Lcom/baidu/sofire/i/m;->a:Landroid/content/Context;
invoke-static {v0}, Lcom/baidu/sofire/i/d;->g(Landroid/content/Context;)[Ljava/lang/String;
move-result-object v0
.line 192
aget-object v0, v0, v3
.line 195
const-string v2, "eos"
.line 197
const-string v3, "User-Agent"
new-instance v4, Ljava/lang/StringBuilder;
invoke-direct {v4}, Ljava/lang/StringBuilder;-><init>()V
invoke-virtual {v4, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
const-string v4, "/"
invoke-virtual {v2, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
const-string v2, "/"
invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
iget-object v2, p0, Lcom/baidu/sofire/i/m;->a:Landroid/content/Context;
invoke-static {v2}, Lcom/baidu/sofire/i/w;->a(Landroid/content/Context;)Ljava/lang/String;
move-result-object v2
invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
const-string v2, "/3.3.9.5"
invoke-virtual {v0, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v0
invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v0
invoke-virtual {v1, v3, v0}, Ljava/net/HttpURLConnection;->setRequestProperty(Ljava/lang/String;Ljava/lang/String;)V
.line 199
const-string v0, "Pragma"
const-string v2, "no-cache"
invoke-virtual {v1, v0, v2}, Ljava/net/HttpURLConnection;->setRequestProperty(Ljava/lang/String;Ljava/lang/String;)V
.line 200
const-string v0, "Accept"
const-string v2, "*/*"
invoke-virtual {v1, v0, v2}, Ljava/net/HttpURLConnection;->setRequestProperty(Ljava/lang/String;Ljava/lang/String;)V
.line 201
const-string v0, "Content-Type"
const-string v2, "application/x-www-form-urlencoded"
invoke-virtual {v1, v0, v2}, Ljava/net/HttpURLConnection;->setRequestProperty(Ljava/lang/String;Ljava/lang/String;)V
.line 202
const-string v0, "Accept-Encoding"
const-string v2, "gzip,deflate"
invoke-virtual {v1, v0, v2}, Ljava/net/HttpURLConnection;->setRequestProperty(Ljava/lang/String;Ljava/lang/String;)V
.line 203
const-string v0, "Accept-Language"
new-instance v2, Ljava/lang/StringBuilder;
invoke-direct {v2}, Ljava/lang/StringBuilder;-><init>()V
invoke-static {}, Ljava/util/Locale;->getDefault()Ljava/util/Locale;
move-result-object v3
invoke-virtual {v3}, Ljava/util/Locale;->getLanguage()Ljava/lang/String;
move-result-object v3
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
const-string v3, "-"
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
.line 204
invoke-static {}, Ljava/util/Locale;->getDefault()Ljava/util/Locale;
move-result-object v3
invoke-virtual {v3}, Ljava/util/Locale;->getCountry()Ljava/lang/String;
move-result-object v3
invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v2
.line 203
invoke-virtual {v1, v0, v2}, Ljava/net/HttpURLConnection;->setRequestProperty(Ljava/lang/String;Ljava/lang/String;)V
.line 205
const-string v0, "x-device-id"
iget-object v2, p0, Lcom/baidu/sofire/i/m;->a:Landroid/content/Context;
invoke-static {v2}, Lcom/baidu/sofire/i/g;->b(Landroid/content/Context;)Ljava/lang/String;
move-result-object v2
invoke-static {v2}, Lcom/baidu/sofire/i/o;->a(Ljava/lang/String;)Ljava/lang/String;
move-result-object v2
invoke-virtual {v1, v0, v2}, Ljava/net/HttpURLConnection;->setRequestProperty(Ljava/lang/String;Ljava/lang/String;)V
.line 206
return-object v1
.line 156
:cond_14a
:try_start_14a
invoke-static {v4}, Ljava/lang/Integer;->parseInt(Ljava/lang/String;)I
:try_end_14d
.catch Ljava/lang/Throwable; {:try_start_14a .. :try_end_14d} :catch_1d1
move-result v0
goto/16 :goto_61
.line 162
:cond_150
iget-object v0, p0, Lcom/baidu/sofire/i/m;->a:Landroid/content/Context;
invoke-static {v0}, Landroid/net/Proxy;->getHost(Landroid/content/Context;)Ljava/lang/String;
move-result-object v1
.line 163
iget-object v0, p0, Lcom/baidu/sofire/i/m;->a:Landroid/content/Context;
invoke-static {v0}, Landroid/net/Proxy;->getPort(Landroid/content/Context;)I
move-result v0
goto/16 :goto_61
.line 173
:cond_15e
invoke-virtual {v2}, Ljava/net/URL;->openConnection()Ljava/net/URLConnection;
move-result-object v0
check-cast v0, Ljava/net/HttpURLConnection;
move-object v1, v0
goto/16 :goto_77
.line 1105
:cond_167
:try_start_167
const-string v2, "TLS"
invoke-static {v2}, Ljavax/net/ssl/SSLContext;->getInstance(Ljava/lang/String;)Ljavax/net/ssl/SSLContext;
move-result-object v4
.line 1107
invoke-static {}, Ljavax/net/ssl/TrustManagerFactory;->getDefaultAlgorithm()Ljava/lang/String;
move-result-object v2
.line 1106
invoke-static {v2}, Ljavax/net/ssl/TrustManagerFactory;->getInstance(Ljava/lang/String;)Ljavax/net/ssl/TrustManagerFactory;
move-result-object v2
.line 1108
const/4 v5, 0x0
invoke-virtual {v2, v5}, Ljavax/net/ssl/TrustManagerFactory;->init(Ljava/security/KeyStore;)V
.line 1109
invoke-virtual {v2}, Ljavax/net/ssl/TrustManagerFactory;->getTrustManagers()[Ljavax/net/ssl/TrustManager;
move-result-object v2
.line 1110
array-length v5, v2
if-lez v5, :cond_187
const/4 v5, 0x0
aget-object v5, v2, v5
instance-of v5, v5, Ljavax/net/ssl/X509TrustManager;
if-nez v5, :cond_1a6
.line 1111
:cond_187
new-instance v0, Ljava/lang/IllegalStateException;
new-instance v4, Ljava/lang/StringBuilder;
const-string v5, "Unexpected default trust managers:"
invoke-direct {v4, v5}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
.line 1112
invoke-static {v2}, Ljava/util/Arrays;->toString([Ljava/lang/Object;)Ljava/lang/String;
move-result-object v2
invoke-virtual {v4, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
move-result-object v2
invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
move-result-object v2
invoke-direct {v0, v2}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V
throw v0
:try_end_1a0
.catch Ljava/lang/Throwable; {:try_start_167 .. :try_end_1a0} :catch_1a0
.line 1122
:catch_1a0
move-exception v0
invoke-static {}, Lcom/baidu/sofire/i/d;->a()V
goto/16 :goto_94
.line 1114
:cond_1a6
const/4 v5, 0x0
const/4 v6, 0x1
:try_start_1a8
new-array v6, v6, [Ljavax/net/ssl/TrustManager;
const/4 v7, 0x0
new-instance v8, Lcom/baidu/sofire/i/m$a;
const/4 v9, 0x0
aget-object v2, v2, v9
check-cast v2, Ljavax/net/ssl/X509TrustManager;
invoke-direct {v8, p0, v2}, Lcom/baidu/sofire/i/m$a;-><init>(Lcom/baidu/sofire/i/m;Ljavax/net/ssl/X509TrustManager;)V
aput-object v8, v6, v7
new-instance v2, Ljava/security/SecureRandom;
invoke-direct {v2}, Ljava/security/SecureRandom;-><init>()V
invoke-virtual {v4, v5, v6, v2}, Ljavax/net/ssl/SSLContext;->init([Ljavax/net/ssl/KeyManager;[Ljavax/net/ssl/TrustManager;Ljava/security/SecureRandom;)V
.line 1116
invoke-virtual {v4}, Ljavax/net/ssl/SSLContext;->getSocketFactory()Ljavax/net/ssl/SSLSocketFactory;
move-result-object v2
sput-object v2, Lcom/baidu/sofire/i/m;->h:Ljavax/net/ssl/SSLSocketFactory;
.line 1118
sget-object v2, Lorg/apache/http/conn/ssl/SSLSocketFactory;->STRICT_HOSTNAME_VERIFIER:Lorg/apache/http/conn/ssl/X509HostnameVerifier;
invoke-virtual {v0, v2}, Ljavax/net/ssl/HttpsURLConnection;->setHostnameVerifier(Ljavax/net/ssl/HostnameVerifier;)V
.line 1120
sget-object v2, Lcom/baidu/sofire/i/m;->h:Ljavax/net/ssl/SSLSocketFactory;
invoke-virtual {v0, v2}, Ljavax/net/ssl/HttpsURLConnection;->setSSLSocketFactory(Ljavax/net/ssl/SSLSocketFactory;)V
:try_end_1cf
.catch Ljava/lang/Throwable; {:try_start_1a8 .. :try_end_1cf} :catch_1a0
goto/16 :goto_94
.line 158
:catch_1d1
move-exception v4
goto/16 :goto_61
:cond_1d4
move v0, v3
goto/16 :goto_61
.end method
.method private a(Ljava/lang/String;Ljava/lang/String;)V
.registers 3
.prologue
.line 92
iput-object p1, p0, Lcom/baidu/sofire/i/m;->c:Ljava/lang/String;
.line 93
iput-object p2, p0, Lcom/baidu/sofire/i/m;->d:Ljava/lang/String;
.line 94
return-void
.end method
.method private a(Ljava/io/InputStream;Ljava/io/File;)Z
.registers 8
.prologue
const/4 v0, 0x0
.line 493
const/4 v2, 0x0
.line 494
iget-boolean v1, p0, Lcom/baidu/sofire/i/m;->g:Z
if-eqz v1, :cond_c
.line 496
:try_start_6
new-instance v1, Ljava/util/zip/GZIPInputStream;
invoke-direct {v1, p1}, Ljava/util/zip/GZIPInputStream;-><init>(Ljava/io/InputStream;)V
:try_end_b
.catch Ljava/io/IOException; {:try_start_6 .. :try_end_b} :catch_f
move-object p1, v1
.line 502
:cond_c
:goto_c
if-nez p1, :cond_14
.line 515
:cond_e
:goto_e
return v0
.line 498
:catch_f
move-exception v1
invoke-static {}, Lcom/baidu/sofire/i/d;->a()V
goto :goto_c
.line 505
:cond_14
:try_start_14
new-instance v1, Ljava/io/BufferedOutputStream;
new-instance v3, Ljava/io/FileOutputStream;
invoke-direct {v3, p2}, Ljava/io/FileOutputStream;-><init>(Ljava/io/File;)V
invoke-direct {v1, v3}, Ljava/io/BufferedOutputStream;-><init>(Ljava/io/OutputStream;)V
:try_end_1e
.catch Ljava/lang/Throwable; {:try_start_14 .. :try_end_1e} :catch_59
.catchall {:try_start_14 .. :try_end_1e} :catchall_4a
.line 507
const/16 v2, 0x400
:try_start_20
new-array v2, v2, [B
.line 508
:goto_22
invoke-virtual {p1, v2}, Ljava/io/InputStream;->read([B)I
move-result v3
const/4 v4, -0x1
if-eq v3, v4, :cond_40
.line 509
const/4 v4, 0x0
invoke-virtual {v1, v2, v4, v3}, Ljava/io/BufferedOutputStream;->write([BII)V
.line 510
invoke-virtual {v1}, Ljava/io/BufferedOutputStream;->flush()V
:try_end_30
.catch Ljava/lang/Throwable; {:try_start_20 .. :try_end_30} :catch_31
.catchall {:try_start_20 .. :try_end_30} :catchall_57
goto :goto_22
.line 514
:catch_31
move-exception v2
:goto_32
:try_start_32
invoke-static {}, Lcom/baidu/sofire/i/d;->a()V
:try_end_35
.catchall {:try_start_32 .. :try_end_35} :catchall_57
.line 517
if-eqz v1, :cond_e
.line 519
:try_start_37
invoke-virtual {v1}, Ljava/io/BufferedOutputStream;->close()V
:try_end_3a
.catch Ljava/io/IOException; {:try_start_37 .. :try_end_3a} :catch_3b
goto :goto_e
.line 521
:catch_3b
move-exception v1
invoke-static {}, Lcom/baidu/sofire/i/d;->a()V
goto :goto_e
.line 519
:cond_40
:try_start_40
invoke-virtual {v1}, Ljava/io/BufferedOutputStream;->close()V
:try_end_43
.catch Ljava/io/IOException; {:try_start_40 .. :try_end_43} :catch_45
.line 512
:goto_43
const/4 v0, 0x1
goto :goto_e
.line 521
:catch_45
move-exception v0
invoke-static {}, Lcom/baidu/sofire/i/d;->a()V
goto :goto_43
.line 517
:catchall_4a
move-exception v0
move-object v1, v2
:goto_4c
if-eqz v1, :cond_51
.line 519
:try_start_4e
invoke-virtual {v1}, Ljava/io/BufferedOutputStream;->close()V
:try_end_51
.catch Ljava/io/IOException; {:try_start_4e .. :try_end_51} :catch_52
.line 522
:cond_51
:goto_51
throw v0
.line 521
:catch_52
move-exception v1
invoke-static {}, Lcom/baidu/sofire/i/d;->a()V
goto :goto_51
.line 517
:catchall_57
move-exception v0
goto :goto_4c
.line 514
:catch_59
move-exception v1
move-object v1, v2
goto :goto_32
.end method
.method private static b(Ljava/io/InputStream;)[B
.registers 5
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;,
Ljava/lang/InterruptedException;
}
.end annotation
.prologue
.line 396
new-instance v0, Ljava/io/ByteArrayOutputStream;
invoke-direct {v0}, Ljava/io/ByteArrayOutputStream;-><init>()V
.line 397
const/16 v1, 0x400
new-array v1, v1, [B
.line 398
:goto_9
invoke-virtual {p0, v1}, Ljava/io/InputStream;->read([B)I
move-result v2
const/4 v3, -0x1
if-eq v2, v3, :cond_15
.line 399
const/4 v3, 0x0
invoke-virtual {v0, v1, v3, v2}, Ljava/io/ByteArrayOutputStream;->write([BII)V
goto :goto_9
.line 402
:cond_15
invoke-virtual {v0}, Ljava/io/ByteArrayOutputStream;->toByteArray()[B
move-result-object v1
.line 403
invoke-virtual {v0}, Ljava/io/ByteArrayOutputStream;->close()V
.line 404
return-object v1
.end method
# virtual methods
.method public final a(Ljava/lang/String;[B)Ljava/lang/String;
.registers 6
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;,
Ljava/lang/InterruptedException;,
Landroid/accounts/NetworkErrorException;
}
.end annotation
.prologue
const/4 v2, 0x0
.line 353
invoke-static {}, Lcom/baidu/sofire/i/v;->a()V
.line 356
:try_start_4
const-string v0, "POST"
invoke-direct {p0, v0, p1}, Lcom/baidu/sofire/i/m;->a(Ljava/lang/String;Ljava/lang/String;)V
:try_end_9
.catchall {:try_start_4 .. :try_end_9} :catchall_30
.line 361
:try_start_9
invoke-direct {p0}, Lcom/baidu/sofire/i/m;->a()Ljava/net/HttpURLConnection;
:try_end_c
.catchall {:try_start_9 .. :try_end_c} :catchall_23
move-result-object v1
.line 362
:try_start_d
invoke-direct {p0, p2, v1}, Lcom/baidu/sofire/i/m;->a([BLjava/net/HttpURLConnection;)Ljava/io/InputStream;
move-result-object v2
.line 363
invoke-direct {p0, v2}, Lcom/baidu/sofire/i/m;->a(Ljava/io/InputStream;)Ljava/lang/String;
:try_end_14
.catchall {:try_start_d .. :try_end_14} :catchall_35
move-result-object v0
.line 366
if-eqz v2, :cond_1a
.line 367
:try_start_17
invoke-virtual {v2}, Ljava/io/InputStream;->close()V
.line 370
:cond_1a
if-eqz v1, :cond_1f
.line 371
invoke-virtual {v1}, Ljava/net/HttpURLConnection;->disconnect()V
:try_end_1f
.catchall {:try_start_17 .. :try_end_1f} :catchall_30
.line 379
:cond_1f
invoke-static {}, Lcom/baidu/sofire/i/v;->b()V
.line 377
return-object v0
.line 366
:catchall_23
move-exception v0
move-object v1, v2
:goto_25
if-eqz v2, :cond_2a
.line 367
:try_start_27
invoke-virtual {v2}, Ljava/io/InputStream;->close()V
.line 370
:cond_2a
if-eqz v1, :cond_2f
.line 371
invoke-virtual {v1}, Ljava/net/HttpURLConnection;->disconnect()V
.line 372
:cond_2f
throw v0
:try_end_30
.catchall {:try_start_27 .. :try_end_30} :catchall_30
.line 379
:catchall_30
move-exception v0
invoke-static {}, Lcom/baidu/sofire/i/v;->b()V
throw v0
.line 366
:catchall_35
move-exception v0
goto :goto_25
.end method
.method public final a(Ljava/lang/String;Ljava/io/File;)Z
.registers 7
.prologue
const/4 v2, 0x0
const/4 v0, 0x0
.line 447
invoke-static {}, Lcom/baidu/sofire/i/v;->a()V
.line 449
:try_start_5
invoke-static {}, Lcom/baidu/sofire/b;->a()V
.line 450
iget-object v1, p0, Lcom/baidu/sofire/i/m;->a:Landroid/content/Context;
invoke-static {v1}, Lcom/baidu/sofire/i/d;->f(Landroid/content/Context;)Z
:try_end_d
.catchall {:try_start_5 .. :try_end_d} :catchall_4f
move-result v1
if-nez v1, :cond_14
.line 484
invoke-static {}, Lcom/baidu/sofire/i/v;->b()V
.line 468
:goto_13
return v0
.line 454
:cond_14
:try_start_14
invoke-static {p1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z
:try_end_17
.catchall {:try_start_14 .. :try_end_17} :catchall_4f
move-result v1
if-eqz v1, :cond_1e
.line 484
invoke-static {}, Lcom/baidu/sofire/i/v;->b()V
goto :goto_13
.line 458
:cond_1e
:try_start_1e
new-instance v1, Ljava/lang/StringBuilder;
const-string v3, "f= "
invoke-direct {v1, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V
invoke-virtual {v1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
invoke-static {}, Lcom/baidu/sofire/b;->a()V
:try_end_2b
.catchall {:try_start_1e .. :try_end_2b} :catchall_4f
.line 462
:try_start_2b
const-string v1, "GET"
invoke-direct {p0, v1, p1}, Lcom/baidu/sofire/i/m;->a(Ljava/lang/String;Ljava/lang/String;)V
.line 463
invoke-direct {p0}, Lcom/baidu/sofire/i/m;->a()Ljava/net/HttpURLConnection;
:try_end_33
.catch Ljava/lang/Throwable; {:try_start_2b .. :try_end_33} :catch_54
.catchall {:try_start_2b .. :try_end_33} :catchall_6c
move-result-object v1
.line 464
:try_start_34
invoke-direct {p0, v1}, Lcom/baidu/sofire/i/m;->a(Ljava/net/HttpURLConnection;)Ljava/io/InputStream;
move-result-object v2
.line 465
invoke-direct {p0, v2, p2}, Lcom/baidu/sofire/i/m;->a(Ljava/io/InputStream;Ljava/io/File;)Z
:try_end_3b
.catch Ljava/lang/Throwable; {:try_start_34 .. :try_end_3b} :catch_80
.catchall {:try_start_34 .. :try_end_3b} :catchall_7e
move-result v0
.line 471
if-eqz v2, :cond_41
.line 472
:try_start_3e
invoke-virtual {v2}, Ljava/io/InputStream;->close()V
.line 475
:cond_41
if-eqz v1, :cond_46
.line 476
invoke-virtual {v1}, Ljava/net/HttpURLConnection;->disconnect()V
:try_end_46
.catch Ljava/lang/Throwable; {:try_start_3e .. :try_end_46} :catch_4a
.catchall {:try_start_3e .. :try_end_46} :catchall_4f
.line 484
:cond_46
:goto_46
invoke-static {}, Lcom/baidu/sofire/i/v;->b()V
goto :goto_13
.line 480
:catch_4a
move-exception v1
:try_start_4b
invoke-static {}, Lcom/baidu/sofire/i/d;->a()V
:try_end_4e
.catchall {:try_start_4b .. :try_end_4e} :catchall_4f
goto :goto_46
.line 484
:catchall_4f
move-exception v0
invoke-static {}, Lcom/baidu/sofire/i/v;->b()V
throw v0
.line 467
:catch_54
move-exception v1
move-object v1, v2
:goto_56
:try_start_56
invoke-static {}, Lcom/baidu/sofire/i/d;->a()V
:try_end_59
.catchall {:try_start_56 .. :try_end_59} :catchall_7e
.line 471
if-eqz v2, :cond_5e
.line 472
:try_start_5b
invoke-virtual {v2}, Ljava/io/InputStream;->close()V
.line 475
:cond_5e
if-eqz v1, :cond_63
.line 476
invoke-virtual {v1}, Ljava/net/HttpURLConnection;->disconnect()V
:try_end_63
.catch Ljava/lang/Throwable; {:try_start_5b .. :try_end_63} :catch_67
.catchall {:try_start_5b .. :try_end_63} :catchall_4f
.line 484
:cond_63
:goto_63
invoke-static {}, Lcom/baidu/sofire/i/v;->b()V
goto :goto_13
.line 480
:catch_67
move-exception v1
:try_start_68
invoke-static {}, Lcom/baidu/sofire/i/d;->a()V
:try_end_6b
.catchall {:try_start_68 .. :try_end_6b} :catchall_4f
goto :goto_63
.line 470
:catchall_6c
move-exception v0
move-object v1, v2
.line 471
:goto_6e
if-eqz v2, :cond_73
.line 472
:try_start_70
invoke-virtual {v2}, Ljava/io/InputStream;->close()V
.line 475
:cond_73
if-eqz v1, :cond_78
.line 476
invoke-virtual {v1}, Ljava/net/HttpURLConnection;->disconnect()V
:try_end_78
.catch Ljava/lang/Throwable; {:try_start_70 .. :try_end_78} :catch_79
.catchall {:try_start_70 .. :try_end_78} :catchall_4f
.line 481
:cond_78
:goto_78
:try_start_78
throw v0
.line 480
:catch_79
move-exception v1
invoke-static {}, Lcom/baidu/sofire/i/d;->a()V
:try_end_7d
.catchall {:try_start_78 .. :try_end_7d} :catchall_4f
goto :goto_78
.line 470
:catchall_7e
move-exception v0
goto :goto_6e
.line 467
:catch_80
move-exception v3
goto :goto_56
.end method