242 lines
5.3 KiB
Smali
242 lines
5.3 KiB
Smali
.class public Lhg/e;
|
|
.super Ljava/lang/Object;
|
|
.source "StrictContentLengthStrategy.java"
|
|
|
|
# interfaces
|
|
.implements Lzf/e;
|
|
|
|
|
|
# annotations
|
|
.annotation build Lcz/msebera/android/httpclient/annotation/Immutable;
|
|
.end annotation
|
|
|
|
|
|
# static fields
|
|
.field public static final d:Lhg/e;
|
|
|
|
|
|
# instance fields
|
|
.field public final c:I
|
|
|
|
|
|
# direct methods
|
|
.method public static constructor <clinit>()V
|
|
.locals 1
|
|
|
|
.line 1
|
|
new-instance v0, Lhg/e;
|
|
|
|
invoke-direct {v0}, Lhg/e;-><init>()V
|
|
|
|
sput-object v0, Lhg/e;->d:Lhg/e;
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>()V
|
|
.locals 1
|
|
|
|
const/4 v0, -0x1
|
|
|
|
.line 3
|
|
invoke-direct {p0, v0}, Lhg/e;-><init>(I)V
|
|
|
|
return-void
|
|
.end method
|
|
|
|
.method public constructor <init>(I)V
|
|
.locals 0
|
|
|
|
.line 1
|
|
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
|
|
|
.line 2
|
|
iput p1, p0, Lhg/e;->c:I
|
|
|
|
return-void
|
|
.end method
|
|
|
|
|
|
# virtual methods
|
|
.method public a(Ldf/p;)J
|
|
.locals 4
|
|
.annotation system Ldalvik/annotation/Throws;
|
|
value = {
|
|
Lcz/msebera/android/httpclient/HttpException;
|
|
}
|
|
.end annotation
|
|
|
|
const-string v0, "HTTP message"
|
|
|
|
.line 1
|
|
invoke-static {p1, v0}, Lqg/a;->h(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;
|
|
|
|
const-string v0, "Transfer-Encoding"
|
|
|
|
.line 2
|
|
invoke-interface {p1, v0}, Ldf/p;->getFirstHeader(Ljava/lang/String;)Ldf/d;
|
|
|
|
move-result-object v0
|
|
|
|
if-eqz v0, :cond_3
|
|
|
|
.line 3
|
|
invoke-interface {v0}, Ldf/d;->getValue()Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
const-string v1, "chunked"
|
|
|
|
.line 4
|
|
invoke-virtual {v1, v0}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
|
|
|
|
move-result v1
|
|
|
|
if-eqz v1, :cond_1
|
|
|
|
.line 5
|
|
invoke-interface {p1}, Ldf/p;->getProtocolVersion()Lcz/msebera/android/httpclient/ProtocolVersion;
|
|
|
|
move-result-object v0
|
|
|
|
sget-object v1, Lcz/msebera/android/httpclient/HttpVersion;->HTTP_1_0:Lcz/msebera/android/httpclient/HttpVersion;
|
|
|
|
invoke-virtual {v0, v1}, Lcz/msebera/android/httpclient/ProtocolVersion;->lessEquals(Lcz/msebera/android/httpclient/ProtocolVersion;)Z
|
|
|
|
move-result v0
|
|
|
|
if-nez v0, :cond_0
|
|
|
|
const-wide/16 v0, -0x2
|
|
|
|
return-wide v0
|
|
|
|
.line 6
|
|
:cond_0
|
|
new-instance v0, Lcz/msebera/android/httpclient/ProtocolException;
|
|
|
|
const-string v1, "Chunked transfer encoding not allowed for "
|
|
|
|
invoke-static {v1}, Landroid/support/v4/media/d;->a(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
move-result-object v1
|
|
|
|
.line 7
|
|
invoke-interface {p1}, Ldf/p;->getProtocolVersion()Lcz/msebera/android/httpclient/ProtocolVersion;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-direct {v0, p1}, Lcz/msebera/android/httpclient/ProtocolException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
|
|
:cond_1
|
|
const-string p1, "identity"
|
|
|
|
.line 8
|
|
invoke-virtual {p1, v0}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z
|
|
|
|
move-result p1
|
|
|
|
if-eqz p1, :cond_2
|
|
|
|
const-wide/16 v0, -0x1
|
|
|
|
return-wide v0
|
|
|
|
.line 9
|
|
:cond_2
|
|
new-instance p1, Lcz/msebera/android/httpclient/ProtocolException;
|
|
|
|
const-string v1, "Unsupported transfer encoding: "
|
|
|
|
invoke-static {v1, v0}, Lc/g;->a(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object v0
|
|
|
|
invoke-direct {p1, v0}, Lcz/msebera/android/httpclient/ProtocolException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw p1
|
|
|
|
:cond_3
|
|
const-string v0, "Content-Length"
|
|
|
|
.line 10
|
|
invoke-interface {p1, v0}, Ldf/p;->getFirstHeader(Ljava/lang/String;)Ldf/d;
|
|
|
|
move-result-object p1
|
|
|
|
if-eqz p1, :cond_5
|
|
|
|
.line 11
|
|
invoke-interface {p1}, Ldf/d;->getValue()Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
.line 12
|
|
:try_start_0
|
|
invoke-static {p1}, Ljava/lang/Long;->parseLong(Ljava/lang/String;)J
|
|
|
|
move-result-wide v0
|
|
|
|
const-wide/16 v2, 0x0
|
|
|
|
cmp-long v2, v0, v2
|
|
|
|
if-ltz v2, :cond_4
|
|
|
|
return-wide v0
|
|
|
|
.line 13
|
|
:cond_4
|
|
new-instance v0, Lcz/msebera/android/httpclient/ProtocolException;
|
|
|
|
new-instance v1, Ljava/lang/StringBuilder;
|
|
|
|
invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V
|
|
|
|
const-string v2, "Negative content length: "
|
|
|
|
invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
|
|
|
|
invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;
|
|
|
|
move-result-object v1
|
|
|
|
invoke-direct {v0, v1}, Lcz/msebera/android/httpclient/ProtocolException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
:try_end_0
|
|
.catch Ljava/lang/NumberFormatException; {:try_start_0 .. :try_end_0} :catch_0
|
|
|
|
.line 14
|
|
:catch_0
|
|
new-instance v0, Lcz/msebera/android/httpclient/ProtocolException;
|
|
|
|
const-string v1, "Invalid content length: "
|
|
|
|
invoke-static {v1, p1}, Lc/g;->a(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
|
|
|
|
move-result-object p1
|
|
|
|
invoke-direct {v0, p1}, Lcz/msebera/android/httpclient/ProtocolException;-><init>(Ljava/lang/String;)V
|
|
|
|
throw v0
|
|
|
|
.line 15
|
|
:cond_5
|
|
iget p1, p0, Lhg/e;->c:I
|
|
|
|
int-to-long v0, p1
|
|
|
|
return-wide v0
|
|
.end method
|