Salve a tutti.

Sto realizzando una sorta di browser "personalizzato" (con TWebBrowser) ma ho bisogno di modificare il sorgente HTML prima che raggiunga il browser.
Ho pensato che per farlo avrei dovuto realizzare una sorta di proxy interno al programma Delphi medesimo.
Dunque faccio connettere il WebBrowser a localhostorta, dove c'è in ascolto un TIdHTTPServer, il quale contatta (al posto di IE) la risorsa HTTP richiesta, modifica l'output e poi la restituisce al client. VVoVe:

Se mi sono espresso male sono pronto a rispiegare, ma non riesco a trovare parole migliori.

Ora sono riuscito ad "emulare" perfettamente i GET (facile!). E' col post che le cose si fanno più difficili. Questo è il mio codice.


codice:
procedure TMainForm.HTTPProxyCommandGet(AContext: TIdContext;
  ARequestInfo: TIdHTTPRequestInfo; AResponseInfo: TIdHTTPResponseInfo);
var
  Request : string;
  Output : string;
  Params : string;
  PostParams : string;
begin
  Params := '';
  if ARequestInfo.QueryParams <> '' then Params := '?' + ARequestInfo.QueryParams;
  Request := INISettingsUnit.Homepage + ARequestInfo.Document + Params;

  if ARequestInfo.CommandType = hcGET then
    Output := HTTPClient.Get(Request)
  else if ARequestInfo.CommandType = hcPOST then
  begin
    Output := HTTPClient.Post(Request,ARequestInfo.PostStream);
  end;

  (****** FAI DELLE MODIFICHE ALL'OUTPUT *******)

  AResponseInfo.ContentText := Output;

end;
EDIT: ignorate "INISettingsUnit.Homepage". E' facilmente intuibile a cosa serve, e comunque quella parte funziona.

Il problema è quel ARequestInfo.PostStream. Credevo fosse davvero così semplice. Le variabili in Post sono in uno stream, le passo al metodo Post di TIdHTTP e tutto funziona.

Col cavolo.

Dov'è che sbaglio??

Grazie!!!!