idHTTP Post response html cut

4

Good.

I'm doing a Post via idHTTP where the result comes in StringStream .

The problem that this result is coming in half. In case, hacking the html response.

Is there a way to buffer this Post?

Note: I use DelphiXE7.

  var
    fHTTP: THTTP;//Classe que utilizo para alimentar o idHTTP
    slParam: TStringList;
  begin
    fHTTP := THTTP.Create;
    slParam := TStringList.Create;
    try
      slParam.Add('modo=C');
      slParam.Add('NumeroRENACH=');
      slParam.Add('txtDocPrincipal=');
      slParam.Add('oculto=');
      slParam.Add('txtCodigo='+ fCaptcha);
      slParam.Add('Submit=Consultar');

      fHTTP.pLimpaParams;
      fHTTP.Params.Host := 'consultas.detrannet.sc.gov.br';
      fHTTP.Params.Connection := 'keep-alive';
      fHTTP.Params.ContentLength := Length(slParam.Text);
      fHTTP.Params.CacheControl := 'max-age=0';
      fHTTP.Params.UserAgent := 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36';
      fHTTP.Params.ContentType := 'application/x-www-form-urlencoded';
      fHTTP.Params.Accept := 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8';
      fHTTP.Params.AcceptEncoding := 'gzip, deflate';
      fHTTP.Params.AcceptLanguage := 'pt-BR,pt;q=0.8,en-US;q=0.6,en;q=0.4';
      fHTTP.Params.CustomHeaders.Values['Cookie'] := ACookie;
      fHTTP.Params.CustomHeaders.Values['Upgrade-Insecure-Requests'] := '1';

      fHTTP.Params.ProtocolVersion := 1;

      fHTTP.Post('http://consultas.detrannet.sc.gov.br'+RemotePath,slParam);
  finally
    FreeAndNil(fHTTP);
    FreeAndNil(slParam);
  end;
end;
    
asked by anonymous 04.10.2016 / 19:08

1 answer

1

I believe the problem is here. fHTTP.Params.ContentLength := Length(slParam.Text); The length of your slParam should be pretty small, do a test, put 10000 in ContentLength, that's probably it. The contentlength that dictates the size of the response you will receive.

If it does not work, it checks if the component has the response attribute, probably in the response it will also have the ContentLength, so you have to move it to a large number to perform this test. If I have the response attribute I believe it would look like this ...

fHTTP.Response.ContentLength := 10000
    
18.11.2016 / 00:46