[REBOL] Re: jpeg images not working
From: brett:codeconscious at: 29-Aug-2002 23:05
> I think from looking again at your script is that all you
> want to do is display an image in a web page. I don't
> understand why you are using MIME.
Don't know if this is of anyhelp but anyways...
I think Tim is trying to do server push?
Along that route (not done it before reading this thread) I've some marginal
success with the script below in Netscape. That is netscape replaces the
entity, but IE just returns all the sections. Maybe IE does not understand
x-mixed-replace
?
Anyway the problem with this script is that it needs to flush the OUTPUT
port just prior to the wait but doesn't and I don't know how to do that.
Someone else help?! :^)
To include the image it will need to be written to the port as binary unless
there is an option to encode it as base64 (which would need extra headers
and using enbase). If you change the mode of the port to binary (again
how?) you need to ensure that the "normal" text lines and headers end in
CRLF (the script below relies on REBOL outputing the CRLF as a line ending).
Regards,
Brett.
#!e: /program files/rebol/core/rebol -cs
REBOL [
Title: {Server Push Test}
Author: {Brett Handley}
Date: 29-Aug-2002
Comment: {
(1) See http://wp.netscape.com/assist/net_sites/pushpull.html
(2) Some success with Netscape, not so with IE.
}
]
boundary: "ThisRandomString"
emit: func [data /local buf] [
print either string? data [data] [rejoin data]
]
emit [
{Content-Type: multipart/x-mixed-replace; boundary="}
boundary {"}
]
emit {}
emit [NEWLINE {--} boundary]
repeat i 3 [
emit [{Content-Type: text/html} newline]
emit [{<h1>} "script-time: " now </h1>]
emit [NEWLINE {--} boundary]
; NEED TO FLUSH OUTPUT HERE - HOW?
wait 00:00:03
]
emit {}
QUIT