.class public abstract Lorg/apache/http/impl/io/AbstractMessageParser; .super Ljava/lang/Object; .source "AbstractMessageParser.java" # interfaces .implements Lorg/apache/http/io/HttpMessageParser; # annotations .annotation system Ldalvik/annotation/Signature; value = { "", "Ljava/lang/Object;", "Lorg/apache/http/io/HttpMessageParser<", "TT;>;" } .end annotation # static fields .field private static final HEADERS:I = 0x1 .field private static final HEAD_LINE:I # instance fields .field private final headerLines:Ljava/util/List; .annotation system Ldalvik/annotation/Signature; value = { "Ljava/util/List<", "Lorg/apache/http/util/CharArrayBuffer;", ">;" } .end annotation .end field .field protected final lineParser:Lorg/apache/http/message/LineParser; .field private message:Lorg/apache/http/HttpMessage; .annotation system Ldalvik/annotation/Signature; value = { "TT;" } .end annotation .end field .field private final messageConstraints:Lorg/apache/http/config/MessageConstraints; .field private final sessionBuffer:Lorg/apache/http/io/SessionInputBuffer; .field private state:I # direct methods .method public constructor (Lorg/apache/http/io/SessionInputBuffer;Lorg/apache/http/message/LineParser;Lorg/apache/http/config/MessageConstraints;)V .registers 5 .line 110 invoke-direct {p0}, Ljava/lang/Object;->()V .line 111 const-string v0, "Session input buffer" invoke-static {p1, v0}, Lorg/apache/http/util/Args;->notNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object; move-result-object p1 check-cast p1, Lorg/apache/http/io/SessionInputBuffer; iput-object p1, p0, Lorg/apache/http/impl/io/AbstractMessageParser;->sessionBuffer:Lorg/apache/http/io/SessionInputBuffer; if-eqz p2, :cond_10 goto :goto_12 .line 112 :cond_10 sget-object p2, Lorg/apache/http/message/BasicLineParser;->INSTANCE:Lorg/apache/http/message/BasicLineParser; :goto_12 iput-object p2, p0, Lorg/apache/http/impl/io/AbstractMessageParser;->lineParser:Lorg/apache/http/message/LineParser; if-eqz p3, :cond_17 goto :goto_19 .line 113 :cond_17 sget-object p3, Lorg/apache/http/config/MessageConstraints;->DEFAULT:Lorg/apache/http/config/MessageConstraints; :goto_19 iput-object p3, p0, Lorg/apache/http/impl/io/AbstractMessageParser;->messageConstraints:Lorg/apache/http/config/MessageConstraints; .line 114 new-instance p1, Ljava/util/ArrayList; invoke-direct {p1}, Ljava/util/ArrayList;->()V iput-object p1, p0, Lorg/apache/http/impl/io/AbstractMessageParser;->headerLines:Ljava/util/List; const/4 p1, 0x0 .line 115 iput p1, p0, Lorg/apache/http/impl/io/AbstractMessageParser;->state:I return-void .end method .method public constructor (Lorg/apache/http/io/SessionInputBuffer;Lorg/apache/http/message/LineParser;Lorg/apache/http/params/HttpParams;)V .registers 5 .annotation runtime Ljava/lang/Deprecated; .end annotation .line 85 invoke-direct {p0}, Ljava/lang/Object;->()V .line 86 const-string v0, "Session input buffer" invoke-static {p1, v0}, Lorg/apache/http/util/Args;->notNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object; .line 87 const-string v0, "HTTP parameters" invoke-static {p3, v0}, Lorg/apache/http/util/Args;->notNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object; .line 88 iput-object p1, p0, Lorg/apache/http/impl/io/AbstractMessageParser;->sessionBuffer:Lorg/apache/http/io/SessionInputBuffer; .line 89 invoke-static {p3}, Lorg/apache/http/params/HttpParamConfig;->getMessageConstraints(Lorg/apache/http/params/HttpParams;)Lorg/apache/http/config/MessageConstraints; move-result-object p1 iput-object p1, p0, Lorg/apache/http/impl/io/AbstractMessageParser;->messageConstraints:Lorg/apache/http/config/MessageConstraints; if-eqz p2, :cond_18 goto :goto_1a .line 90 :cond_18 sget-object p2, Lorg/apache/http/message/BasicLineParser;->INSTANCE:Lorg/apache/http/message/BasicLineParser; :goto_1a iput-object p2, p0, Lorg/apache/http/impl/io/AbstractMessageParser;->lineParser:Lorg/apache/http/message/LineParser; .line 91 new-instance p1, Ljava/util/ArrayList; invoke-direct {p1}, Ljava/util/ArrayList;->()V iput-object p1, p0, Lorg/apache/http/impl/io/AbstractMessageParser;->headerLines:Ljava/util/List; const/4 p1, 0x0 .line 92 iput p1, p0, Lorg/apache/http/impl/io/AbstractMessageParser;->state:I return-void .end method .method public static parseHeaders(Lorg/apache/http/io/SessionInputBuffer;IILorg/apache/http/message/LineParser;)[Lorg/apache/http/Header; .registers 5 .annotation system Ldalvik/annotation/Throws; value = { Lorg/apache/http/HttpException;, Ljava/io/IOException; } .end annotation .line 142 new-instance v0, Ljava/util/ArrayList; invoke-direct {v0}, Ljava/util/ArrayList;->()V if-eqz p3, :cond_8 goto :goto_a .line 143 :cond_8 sget-object p3, Lorg/apache/http/message/BasicLineParser;->INSTANCE:Lorg/apache/http/message/BasicLineParser; :goto_a invoke-static {p0, p1, p2, p3, v0}, Lorg/apache/http/impl/io/AbstractMessageParser;->parseHeaders(Lorg/apache/http/io/SessionInputBuffer;IILorg/apache/http/message/LineParser;Ljava/util/List;)[Lorg/apache/http/Header; move-result-object p0 return-object p0 .end method .method public static parseHeaders(Lorg/apache/http/io/SessionInputBuffer;IILorg/apache/http/message/LineParser;Ljava/util/List;)[Lorg/apache/http/Header; .registers 13 .annotation system Ldalvik/annotation/Signature; value = { "(", "Lorg/apache/http/io/SessionInputBuffer;", "II", "Lorg/apache/http/message/LineParser;", "Ljava/util/List<", "Lorg/apache/http/util/CharArrayBuffer;", ">;)[", "Lorg/apache/http/Header;" } .end annotation .annotation system Ldalvik/annotation/Throws; value = { Lorg/apache/http/HttpException;, Ljava/io/IOException; } .end annotation .line 178 const-string v0, "Session input buffer" invoke-static {p0, v0}, Lorg/apache/http/util/Args;->notNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object; .line 179 const-string v0, "Line parser" invoke-static {p3, v0}, Lorg/apache/http/util/Args;->notNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object; .line 180 const-string v0, "Header line list" invoke-static {p4, v0}, Lorg/apache/http/util/Args;->notNull(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object; const/4 v0, 0x0 move-object v1, v0 move-object v2, v1 :cond_12 :goto_12 if-nez v1, :cond_1c .line 186 new-instance v1, Lorg/apache/http/util/CharArrayBuffer; const/16 v3, 0x40 invoke-direct {v1, v3}, Lorg/apache/http/util/CharArrayBuffer;->(I)V goto :goto_1f .line 188 :cond_1c invoke-virtual {v1}, Lorg/apache/http/util/CharArrayBuffer;->clear()V .line 190 :goto_1f invoke-interface {p0, v1}, Lorg/apache/http/io/SessionInputBuffer;->readLine(Lorg/apache/http/util/CharArrayBuffer;)I move-result v3 const/4 v4, -0x1 const/4 v5, 0x0 if-eq v3, v4, :cond_8d .line 191 invoke-virtual {v1}, Lorg/apache/http/util/CharArrayBuffer;->length()I move-result v3 const/4 v4, 0x1 if-ge v3, v4, :cond_2f goto :goto_8d .line 198 :cond_2f invoke-virtual {v1, v5}, Lorg/apache/http/util/CharArrayBuffer;->charAt(I)C move-result v3 const/16 v6, 0x9 const/16 v7, 0x20 if-eq v3, v7, :cond_3f invoke-virtual {v1, v5}, Lorg/apache/http/util/CharArrayBuffer;->charAt(I)C move-result v3 if-ne v3, v6, :cond_77 :cond_3f if-eqz v2, :cond_77 .line 202 :goto_41 invoke-virtual {v1}, Lorg/apache/http/util/CharArrayBuffer;->length()I move-result v3 if-ge v5, v3, :cond_53 .line 203 invoke-virtual {v1, v5}, Lorg/apache/http/util/CharArrayBuffer;->charAt(I)C move-result v3 if-eq v3, v7, :cond_50 if-eq v3, v6, :cond_50 goto :goto_53 :cond_50 add-int/lit8 v5, v5, 0x1 goto :goto_41 :cond_53 :goto_53 if-lez p2, :cond_6b .line 209 invoke-virtual {v2}, Lorg/apache/http/util/CharArrayBuffer;->length()I move-result v3 add-int/2addr v3, v4 invoke-virtual {v1}, Lorg/apache/http/util/CharArrayBuffer;->length()I move-result v4 add-int/2addr v3, v4 sub-int/2addr v3, v5 if-gt v3, p2, :cond_63 goto :goto_6b .line 211 :cond_63 new-instance p0, Lorg/apache/http/MessageConstraintException; const-string p1, "Maximum line length limit exceeded" invoke-direct {p0, p1}, Lorg/apache/http/MessageConstraintException;->(Ljava/lang/String;)V throw p0 .line 213 :cond_6b :goto_6b invoke-virtual {v2, v7}, Lorg/apache/http/util/CharArrayBuffer;->append(C)V .line 214 invoke-virtual {v1}, Lorg/apache/http/util/CharArrayBuffer;->length()I move-result v3 sub-int/2addr v3, v5 invoke-virtual {v2, v1, v5, v3}, Lorg/apache/http/util/CharArrayBuffer;->append(Lorg/apache/http/util/CharArrayBuffer;II)V goto :goto_7c .line 216 :cond_77 invoke-interface {p4, v1}, Ljava/util/List;->add(Ljava/lang/Object;)Z move-object v2, v1 move-object v1, v0 :goto_7c if-lez p1, :cond_12 .line 220 invoke-interface {p4}, Ljava/util/List;->size()I move-result v3 if-ge v3, p1, :cond_85 goto :goto_12 .line 221 :cond_85 new-instance p0, Lorg/apache/http/MessageConstraintException; const-string p1, "Maximum header count exceeded" invoke-direct {p0, p1}, Lorg/apache/http/MessageConstraintException;->(Ljava/lang/String;)V throw p0 .line 224 :cond_8d :goto_8d invoke-interface {p4}, Ljava/util/List;->size()I move-result p0 new-array p0, p0, [Lorg/apache/http/Header; .line 225 :goto_93 invoke-interface {p4}, Ljava/util/List;->size()I move-result p1 if-ge v5, p1, :cond_b3 .line 226 invoke-interface {p4, v5}, Ljava/util/List;->get(I)Ljava/lang/Object; move-result-object p1 check-cast p1, Lorg/apache/http/util/CharArrayBuffer; .line 228 :try_start_9f invoke-interface {p3, p1}, Lorg/apache/http/message/LineParser;->parseHeader(Lorg/apache/http/util/CharArrayBuffer;)Lorg/apache/http/Header; move-result-object p1 aput-object p1, p0, v5 :try_end_a5 .catch Lorg/apache/http/ParseException; {:try_start_9f .. :try_end_a5} :catch_a8 add-int/lit8 v5, v5, 0x1 goto :goto_93 :catch_a8 move-exception p0 .line 230 new-instance p1, Lorg/apache/http/ProtocolException; invoke-virtual {p0}, Lorg/apache/http/ParseException;->getMessage()Ljava/lang/String; move-result-object p0 invoke-direct {p1, p0}, Lorg/apache/http/ProtocolException;->(Ljava/lang/String;)V throw p1 :cond_b3 return-object p0 .end method # virtual methods .method public parse()Lorg/apache/http/HttpMessage; .registers 6 .annotation system Ldalvik/annotation/Signature; value = { "()TT;" } .end annotation .annotation system Ldalvik/annotation/Throws; value = { Ljava/io/IOException;, Lorg/apache/http/HttpException; } .end annotation .line 255 iget v0, p0, Lorg/apache/http/impl/io/AbstractMessageParser;->state:I const/4 v1, 0x1 if-eqz v0, :cond_10 if-ne v0, v1, :cond_8 goto :goto_1a .line 279 :cond_8 new-instance v0, Ljava/lang/IllegalStateException; const-string v1, "Inconsistent parser state" invoke-direct {v0, v1}, Ljava/lang/IllegalStateException;->(Ljava/lang/String;)V throw v0 .line 259 :cond_10 :try_start_10 iget-object v0, p0, Lorg/apache/http/impl/io/AbstractMessageParser;->sessionBuffer:Lorg/apache/http/io/SessionInputBuffer; invoke-virtual {p0, v0}, Lorg/apache/http/impl/io/AbstractMessageParser;->parseHead(Lorg/apache/http/io/SessionInputBuffer;)Lorg/apache/http/HttpMessage; move-result-object v0 iput-object v0, p0, Lorg/apache/http/impl/io/AbstractMessageParser;->message:Lorg/apache/http/HttpMessage; :try_end_18 .catch Lorg/apache/http/ParseException; {:try_start_10 .. :try_end_18} :catch_43 .line 263 iput v1, p0, Lorg/apache/http/impl/io/AbstractMessageParser;->state:I .line 266 :goto_1a iget-object v0, p0, Lorg/apache/http/impl/io/AbstractMessageParser;->sessionBuffer:Lorg/apache/http/io/SessionInputBuffer; iget-object v1, p0, Lorg/apache/http/impl/io/AbstractMessageParser;->messageConstraints:Lorg/apache/http/config/MessageConstraints; invoke-virtual {v1}, Lorg/apache/http/config/MessageConstraints;->getMaxHeaderCount()I move-result v1 iget-object v2, p0, Lorg/apache/http/impl/io/AbstractMessageParser;->messageConstraints:Lorg/apache/http/config/MessageConstraints; invoke-virtual {v2}, Lorg/apache/http/config/MessageConstraints;->getMaxLineLength()I move-result v2 iget-object v3, p0, Lorg/apache/http/impl/io/AbstractMessageParser;->lineParser:Lorg/apache/http/message/LineParser; iget-object v4, p0, Lorg/apache/http/impl/io/AbstractMessageParser;->headerLines:Ljava/util/List; invoke-static {v0, v1, v2, v3, v4}, Lorg/apache/http/impl/io/AbstractMessageParser;->parseHeaders(Lorg/apache/http/io/SessionInputBuffer;IILorg/apache/http/message/LineParser;Ljava/util/List;)[Lorg/apache/http/Header; move-result-object v0 .line 272 iget-object v1, p0, Lorg/apache/http/impl/io/AbstractMessageParser;->message:Lorg/apache/http/HttpMessage; invoke-interface {v1, v0}, Lorg/apache/http/HttpMessage;->setHeaders([Lorg/apache/http/Header;)V .line 273 iget-object v0, p0, Lorg/apache/http/impl/io/AbstractMessageParser;->message:Lorg/apache/http/HttpMessage; const/4 v1, 0x0 .line 274 iput-object v1, p0, Lorg/apache/http/impl/io/AbstractMessageParser;->message:Lorg/apache/http/HttpMessage; .line 275 iget-object v1, p0, Lorg/apache/http/impl/io/AbstractMessageParser;->headerLines:Ljava/util/List; invoke-interface {v1}, Ljava/util/List;->clear()V const/4 v1, 0x0 .line 276 iput v1, p0, Lorg/apache/http/impl/io/AbstractMessageParser;->state:I return-object v0 :catch_43 move-exception v0 .line 261 new-instance v1, Lorg/apache/http/ProtocolException; invoke-virtual {v0}, Lorg/apache/http/ParseException;->getMessage()Ljava/lang/String; move-result-object v2 invoke-direct {v1, v2, v0}, Lorg/apache/http/ProtocolException;->(Ljava/lang/String;Ljava/lang/Throwable;)V throw v1 .end method .method protected abstract parseHead(Lorg/apache/http/io/SessionInputBuffer;)Lorg/apache/http/HttpMessage; .annotation system Ldalvik/annotation/Signature; value = { "(", "Lorg/apache/http/io/SessionInputBuffer;", ")TT;" } .end annotation .annotation system Ldalvik/annotation/Throws; value = { Ljava/io/IOException;, Lorg/apache/http/HttpException;, Lorg/apache/http/ParseException; } .end annotation .end method