anchor.diff:      property RequestFormParams: TDValue read FRequestFormParams;
       property RequestParams: TDValue read FRequestParams;
       property RequestURL: String read FRequestURL;
  +  end;
  +
  +  /// <summary>
  +  ///   ڽ
  +  /// </summary>
  +  THttpBuffer = class(TObject)
  +  private
  +    // ݵBuilder
  +    FRecvBuilder:TDBufferBuilder;
  +
  +    FContentBuilder: TDBufferBuilder;
  +    FContentLength: Int64;
  +    FHeaderBuilder: TDBufferBuilder;
  +
  +    FRecvSize: Integer;
  +    
  +    /// <summary>
  +    ///   ״̬
  +    /// </summary>
  +    FDecodeState: Integer;
  +
  +    /// <summary>
  +    ///   0: Ҫʼ
  +    ///   1: Ѿʼ
  +    /// </summary>
  +    FFlag: Byte;
  +
  +    /// <summary>
  +    ///  0: RawHeader;
  +    ///  1: ContentAsRAWString;
  +    /// </summary>
  +    FSectionFlag: Byte;
  +  public
  +    constructor Create();
  +
  +    destructor Destroy; override;
  +
  +    procedure DoCleanUp;
  +
  +    /// <summary>THttpBuffer.InputBuffer
  +    /// </summary>
  +    /// <returns>
  +    ///  0: Ҫɽ
  +    ///  -2: ͷ󳤶(MAX_HEADER_BUFFER_SIZE)
  +    ///  1: 뵽ͷ
  +    ///  2: 뵽
  +    /// </returns>
  +    /// <param name="pvByte"> (Byte) </param>
  +    function InputBuffer(pvByte:Byte): Integer;
  +
  +    /// <summary>
  +    ///   Ҫյݳ
  +    /// </summary>
  +    property ContentLength: Int64 read FContentLength write FContentLength;
   
     end;
   
  
positive.code:     property HeaderBuilder: TDBufferBuilder read FHeaderBuilder;
      property Headers: TDValue read FHeaders;
      property ResponseCode: Word read FResponseCode write FResponseCode;
      property ResponseCodeStr: String read FResponseCodeStr write FResponseCodeStr;
  
  
  
      /// <summary>
  
negative.code:   ZCompressBufferBuilder(FContentBuffer);   
  end;
  
  { THttpBuffer }
  
  constructor THttpBuffer.Create;
  begin
    FContentBuilder := TDBufferBuilder.Create;
    FHeaderBuilder := TDBufferBuilder.Create;
  end;
  
  destructor THttpBuffer.Destroy;
  begin
    FreeAndNil(FContentBuilder);
    FreeAndNil(FHeaderBuilder);
    inherited Destroy;
  end;
  
  procedure THttpBuffer.DoCleanUp;
  begin
    if FContentBuilder <> nil then
      FContentBuilder.Clear;
    if FHeaderBuilder <> nil then
      FHeaderBuilder.Clear;
  
    FRecvBuilder := FHeaderBuilder;
  
    FRecvSize := 0;
    FSectionFlag := 0;
    FFlag := 0;
    FDecodeState := 0;
  end;
  
  function THttpBuffer.InputBuffer(pvByte:Byte): Integer;
  
    procedure InnerCaseZero;
    begin
      if pvByte = 13 then
      begin
        Inc(FDecodeState);
      end;
  
      if FHeaderBuilder.Size >= MAX_HEADER_BUFFER_SIZE then
      begin            // ͷݹ
        FFlag := 0;
        Result := -2;
      end;
    end;
  begin
    Result := 0;
    if FFlag = 0 then
    begin
      FContentBuilder.Clear;
      FHeaderBuilder.Clear;
      FFlag := 1;
      FRecvSize := 0;
    end;
  
    FRecvBuilder.Append(pvByte);
  
    case FDecodeState of
      0:
       begin
         InnerCaseZero;
       end;
      1:    // һ #10
      begin
        if pvByte = 10 then Inc(FDecodeState)
        else
        begin
          FDecodeState := 0;
          InnerCaseZero;
        end;
      end;
      2:  // ڶ #13
      begin
        if pvByte = 13 then Inc(FDecodeState)
        else
        begin
          FDecodeState := 0;
          InnerCaseZero;
        end;
      end;
      3:  // ڶ #10
      begin
        if pvByte = 10 then
        begin  // Header
          FSectionFlag := 1;
          Result := 1;
          Inc(FDecodeState);
          
          FRecvBuilder := FContentBuilder;
          Exit;
        end else
        begin
          FDecodeState := 0;
          InnerCaseZero;
        end;
      end;
      4:  // Content
      begin
        if FContentLength = FContentBuilder.Size then
        begin
          Result := 2;     // ContentAsRAWString
          FFlag := 0;      // ¿ʼBufferн
          Exit;
        end;
      end;
    end;
  end;
  
  end.
  