Autor Beitrag
BungeeBug
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 901



BeitragVerfasst: Fr 02.01.04 11:06 
Hi,

wie kann man im / mitm IdHTTPServer Links benutzen. Ich kann mit dem Code
ausblenden Delphi-Quelltext
1:
AResponseInfo.ContentStream := TFileStream.Create('./web/index.html',fmOpenRead);					


Eine Datei laden und über den Browser anzeigenlassen. Nur wenn diese Datei Links enthält werden diese nicht verarbeitet. Gibt es nun sowas wie nen OnLinkGet Event oder? Oder hab ich einfach nur ne Eigenschaft übersehen oder muss ich selbst ran und was proggen? Hat da jmd. schon nen bissel Code? In den Demos hab ich auch nix gefunden was mir da wirklich geholfen hätte ( Die Demo war / ist meiner Meinung nach mehr als dämlich).
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Fr 02.01.04 12:21 
nimm doch mal
ausblenden Delphi-Quelltext
1:
Aresponse.contenttext := 'hier deinen HTML code rein.'					


probier das mal.

_________________
In the beginning was the word.
And the word was content-type: text/plain.
Ex0rzist
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 550

Win XP Prof.
Mandrake 10.0

D6
BeitragVerfasst: Sa 03.01.04 03:18 
Hi,
ausblenden Delphi-Quelltext
1:
2:
procedure IdHTTPServer1CommandGet(AThread: TIdPeerThread;
  RequestInfo: TIdHTTPRequestInfo; ResponseInfo: TIdHTTPResponseInfo);


Um damit deine Anfragen zu verarbeiten, musst du RequestInfo auswerten. -> siehe Hilfe dazu

Dann gibt es da noch eine Prozedur namens ServeFile.

Dann geht das eigentlich ziemlich einfach:
    -RequestInfo auswerten (welche Datei wird angefordert?)
    -Verfügbarkeit prüfen und ReplyCode (z.B. 200 oder 404 usw.) und MIME-Type (z.B. text/html) setzen
    -Datei mit ServeFile senden

_________________
If accidentally read, induce vomitting.
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Sa 03.01.04 11:11 
bzw mit den anderen routinen, wenn du z.b. einen dynamischen inhalt übergeben willst.

man kann ja auch ohne probleme einen PHP interpreter mit dem INDY webserver laufen lassen !

_________________
In the beginning was the word.
And the word was content-type: text/plain.