Streams an Browser Senden
-
hi,
hab ein kleines Prog das eine html auswertung anzeigen soll, dabei ist es nötig das es streams versenden muss, doch leider klapt das nicht
. Er fängt zwar an den Stream zu senden hört aber dann sofort auf. Hoffe das einer von euch den Fehler im Quelltext siehtvoid TDataModule1::getStream(AnsiString Path,TCustomWinSocket *Socket) { try { int iFileHandle; int iFileLength; iFileHandle = FileOpen( Path , fmOpenRead); iFileLength = FileSeek(iFileHandle, 0, 2); FileClose(iFileHandle); TFileStream* Stream = new TFileStream( Path ,fmOpenRead); Socket->SendText("Content-length: "+AnsiString(/*ResourceSize*/iFileLength)); Socket->SendText(""); Socket->SendStream(Stream); } catch(...) { ServerSocket1->Socket->Close(); } }mfg LordPsycho
-
Nur ein Verdacht, aber vielleicht benötigt dein Pseudo-HTTP-Header etwas mehr Informationen als nur die content-length?
-
im RFC steht das es recht
(http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html)14.13 Content-Length
The Content-Length entity-header field indicates the size of the entity-body, in decimal number of OCTETs, sent to the recipient or, in the case of the HEAD method, the size of the entity-body that would have been sent had the request been a GET.
Content-Length = "Content-Length" ":" 1*DIGIT
An example is
Content-Length: 3495
Applications SHOULD use this field to indicate the transfer-length of the message-body, unless this is prohibited by the rules in section 4.4.
Any Content-Length greater than or equal to zero is a valid value. Section 4.4 describes how to determine the length of a message-body if a Content-Length is not given.
-
Wo steht da, dass man einfach nur Content-Length in den Header knallen kann damit es funktioniert?
-junix