Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Netzwerke (https://www.delphipraxis.net/14-netzwerke/)
-   -   idHTTP.Post hängt sich auf (https://www.delphipraxis.net/172528-idhttp-post-haengt-sich-auf.html)

mocition 8. Jan 2013 21:37

idHTTP.Post hängt sich auf
 
Liste der Anhänge anzeigen (Anzahl: 1)
Hi,

ich nutze TidHTTP um Artikeldaten an einen Onlineshop zu senden. Auf der Testumgebung (localhost) funktioniert alles wunderbar, wenn ich das ganze dann auf dem realen Webserver laufen lassen will, dann hängt sich idHTTP.Post auf und springt in die CPU ohne eine Fehlermeldung auszuwerfen.

Folgenden Einstellungen hab ich:
Code:
RestClient.Request.ContentType := 'application/json';
RestClient.Request.CharSet := 'UTF-8';
RestClient.Request.Host := MeinHost;
RestClient.Request.Connection := 'close';
RestClient.HTTPOptions := [hoInProcessAuth,hoForceEncodeParams];
RestClient.HandleRedirects := True;
Beim Post hängt sich das Programm dann auf:
Code:
try
  Response := restClient.Post(restClient.Request.URL, Strm);
except
  on E: Exception do
  showmessage('Fehler: ' + E.Message);
end;
Die Kontrolle im Fiddler zeigt, dass der erste Post ohne Authentication geschickt wird. D.h. der Fehler liegt beim 2.Post, wenn die Digest-Daten mitgeschickt werden.
Komisch ist, dass bei kleinerer Datenmenge (Content-Length: 120) der Post ohne Probleme funktioniert.

Anbei auch ein Bild des Abbruchs.

Könnt ihr mir da weiterhelfen.
Danke.
mfg Christoph

mocition 9. Jan 2013 10:13

AW: idHTTP.Post hängt sich auf
 
Ich habe jetzt Projekt->Optionen bei "Compilieren" die Option "Mit Debug-DCUs" auf True gesetzt und jetzt läuft es!
Wie es ausschaut ist das Problem bei idIOHandler.pas bei der TIdIOHandler.DiscardAll aufgetreten:
Code:
procedure TIdIOHandler.DiscardAll;
begin
  BeginWork(wmRead);
  try
    // If data already exists in the buffer, discard it first.
    FInputBuffer.Clear;
    // RLebeau - don't call Connected() here!  ReadBytes() already
    // does that internally. Calling Connected() here can cause an
    // EIdConnClosedGracefully exception that breaks the loop
    // prematurely and thus leave unread bytes in the InputBuffer.
    // Let the loop catch the exception before exiting...
    repeat
                                                                       
      try
        if ReadFromSource(False) > 0 then begin
          FInputBuffer.Clear;
        end else begin;
          CheckForDisconnect(True, True);
        end;
      except
        on E: Exception do begin
          // RLebeau - ReadFromSource() could have filled the
          // InputBuffer with more bytes...
          FInputBuffer.Clear;
          if E is EIdConnClosedGracefully then begin
            Break;
          end else begin
            raise;
          end;
        end;
      end;
      TIdAntiFreezeBase.DoProcess;
    until False;
  finally
    EndWork(wmRead);
  end;
end;


Alle Zeitangaben in WEZ +1. Es ist jetzt 23:15 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz