AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Netzwerke Delphi IdHTTP.Post als HTTP/1.1 verschicken und Rang IdHTTP.Request
Thema durchsuchen
Ansicht
Themen-Optionen

IdHTTP.Post als HTTP/1.1 verschicken und Rang IdHTTP.Request

Ein Thema von Hallo_Thomas · begonnen am 19. Mai 2009 · letzter Beitrag vom 19. Mai 2009
Antwort Antwort
Hallo_Thomas

Registriert seit: 18. Apr 2005
Ort: Dresden
405 Beiträge
 
Delphi 2005 Professional
 
#1

IdHTTP.Post als HTTP/1.1 verschicken und Rang IdHTTP.Request

  Alt 19. Mai 2009, 13:13
Hallo,

habe folgende Probleme, mein Post wird immer als POST / HTTP/1.0 verschickt, möchte es aber als POST / HTTP/1.1 verschicken?
Ich weiß nicht wo der Fehler liegt

Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
  data: TIdMultiPartFormDataStream;
begin
  data := TIdMultiPartFormDataStream.Create;
  IdHTTP1.ProtocolVersion:=pv1_1;
  IdHTTP1.Request.UserAgent:='null';
  IdHTTP1.Request.Accept:='eins';
  IdHTTP1.Request.AcceptCharSet:='zwei';
  IdHTTP1.Request.AcceptLanguage:='drei';
  try
    { add the used parameters for the script }
    data.AddFormField('param1', 'value1');
    data.AddFormField('param2', 'value2');
    data.AddFormField('param3', 'value3');
    { Call the Post method of TIdHTTP and read the result into TMemo }
    Memo1.Lines.Text := IdHTTP1.Post('http://www.delphipraxis.net', data);
  finally
    data.Free;
  end;
end;

Wie kann ich die Rangfolge von IdHTTP1.Request verändern, so das zum Beispiel der "User-Agent: null" vor Accept steht?


Delphi-Quellcode:
[*]E Žîâ@ €Á¬À¨²U
"- PF6Š\û¥cÒPÿÿ|v POST / HTTP/1.0
Connection: keep-alive
Content-Type: multipart/form-data; boundary=--------051909045300140
Content-Length: 281
Host: [url]www.delphipraxis.net[/url]
Accept: eins
Accept-Charset: zwei
Accept-Encoding: identity
Accept-Language: drei
User-Agent: null
Dankeschön Thomas
Angehängte Dateien
Dateityp: zip beispiel_exe_169.zip (281,6 KB, 9x aufgerufen)
Dateityp: zip beispiel_119.zip (7,3 KB, 9x aufgerufen)
  Mit Zitat antworten Zitat
mjustin

Registriert seit: 14. Apr 2008
3.004 Beiträge
 
Delphi 2009 Professional
 
#2

Re: IdHTTP.Post als HTTP/1.1 verschicken und Rang IdHTTP.Req

  Alt 19. Mai 2009, 13:33
Indy verwendet immer 1.0, siehe IdHTTP.pas:

Zitat:
// Currently when issuing a POST, IdHTTP will automatically set the protocol
// to version 1.0 independently of the value it had initially. This is because
// there are some servers that don't respect the RFC to the full extent. In
// particular, they don't respect sending/not sending the Expect: 100-Continue
// header. Until we find an optimum solution that does NOT break the RFC, we
// will restrict POSTS to version 1.0.
Eventuell bietet Synapse 1.0.

Oder es hilft, die Options Property hoKeepOrigProtocol zu setzen (auch aus IdHTTP.pas):

Zitat:
// If hoKeepOrigProtocol is SET, is possible to assume that the developer
// is sure in operations of the server
d.h. es funktioniert eventuell mit manchen Servern, aber nicht unbedingt mit jedem.


Cheers,
Michael Justin
habarisoft.com
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 20:16 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