Problems rendering an image + jpeg images not working
[1/20] from: tim:johnsons-web at: 29-Aug-2002 8:46
Hi Rebols:
The same subject matter was mistakenly posted under two
different subjects. My apologies.
To recap: We are developing a project using the Axis Webcameras,
images are transferred from a remote location using their own
onboard Linux OS'es to a server. We are attempting to
convert the perl script found at the following location:
http://www.axis.com/techsup/cam_servers/tech_notes/index.htm
subtext heading:
Live Video on a high hit rate site
the active image load for IE is supposed to be handled
via JavaScript.
My attempt is to rewrite a (supposedly) functional perl
script-which my perl programmer partner can't get to
work- in rebol to push (upload/write) the camera image
to the webpage.
The multipart text conventions and the print/read statements
in the perl script are easy for me to understand and
*appeared* pretty straight forward.
I have now got an image "pushed" to the web page using
the methods suggested by Gabrielle and Scott Jones
(with much-appreciated help from the rest of you).
The method is:
t: read/binary %../images/camera-1/Bed-Tax-Logo.jpg
print "Content-type: image/jpeg^/"
set-modes system/ports/output [binary: true]
foreach u t [insert system/ports/output to-char u]
I was not able to find any examples like this in the documentation
mostly using the Rebol/Core User's Guide Version 2.3
Can anyone point me to rebol specific documentation on this?
for instance, I didn't know about set-modes until Gab and Scott
pointed them out. help set-modes is quite terse.
Thanks again! :-)
-tim-
* Gabriele Santilli <[g--santilli--tiscalinet--it]> [020829 06:34]:
> Hi Tim,
> On Thursday, August 29, 2002, 2:54:43 AM, you wrote:
<<quoted lines omitted: 15>>
> [rebol-request--rebol--com] with "unsubscribe" in the
> subject, without the quotes.
--
Tim Johnson <[tim--johnsons-web--com]>
http://www.alaska-internet-solutions.com
http://www.johnsons-web.com
[2/20] from: gscottjones:mchsi at: 29-Aug-2002 13:36
From: "Tim Johnson"
> I was not able to find any examples like this in the documentation
> mostly using the Rebol/Core User's Guide Version 2.3
>
> Can anyone point me to rebol specific documentation on this?
> for instance, I didn't know about set-modes until Gab and Scott
> pointed them out. help set-modes is quite terse.
Hi, Tim,
I stole it from Gabriele!. ;-)
I frankly don't remember where I first saw this kind of stuff, but it might
have been an example in the rebol library. The option, by the way, is:
t: read/binary %//rebol/view/nyc.jpg
...
dat: copy ""
foreach u t [append dat to-char u]
set-modes system/ports/output [binary: true]
write-io system/ports/output dat length? dat
...
Who knows, maybe this version will work better.
You can find out some more about get-modes and set-modes at:
http://www.rebol.com/docs/core25.html
I read several documents about the experiemental multipart mime, and played
with it for about an hour over lunch. I could not get even a simple
multipart text/html example to run properly on my Apache/REBOL/IE6 set-up on
Win98. I am unsure why. I am out of time. Best of luck figuring this one
out!
--Scott Jones
[3/20] from: tim:johnsons-web at: 29-Aug-2002 11:53
* G. Scott Jones <[gscottjones--mchsi--com]> [020829 11:00]:
> From: "Tim Johnson"
> > I was not able to find any examples like this in the documentation
<<quoted lines omitted: 4>>
> > pointed them out. help set-modes is quite terse.
> Hi, Tim,
Hi Scott:
> I stole it from Gabriele!. ;-)
Gabriele is a very good resource!
> I frankly don't remember where I first saw this kind of stuff, but it might
> have been an example in the rebol library. The option, by the way, is:
<<quoted lines omitted: 6>>
> ...
> Who knows, maybe this version will work better.
Me-thinks buffering is a better way to go, yes!
> You can find out some more about get-modes and set-modes at:
> http://www.rebol.com/docs/core25.html
Thanks, that's going to be very useful.
> I read several documents about the experiemental multipart mime, and played
> with it for about an hour over lunch. I could not get even a simple
> multipart text/html example to run properly on my Apache/REBOL/IE6 set-up on
> Win98. I am unsure why. I am out of time. Best of luck figuring this one
> out!
> --Scott Jones
That's a tough one all right (at least for my feeble brain). With Allen
Kamp's help, I set up a feature to send html as an email message. I had
a headache by the time I was finished.
Thanks again...
--
Tim Johnson <[tim--johnsons-web--com]>
http://www.alaska-internet-solutions.com
http://www.johnsons-web.com
[4/20] from: g:santilli:tiscalinet:it at: 30-Aug-2002 1:28
Hi Tim,
On Thursday, August 29, 2002, 9:53:22 PM, you wrote:
TJ> Gabriele is a very good resource!
;-)
Anyway, SET-MODES and GET-MODES are not much documented; they do a
lot of things, among these there's the ability to set the port
flags that in previous versions you could only set when opening
the port (i.e. with /BINARY, /LINES, etc.).
>> t: read/binary %//rebol/view/nyc.jpg
>> ...
<<quoted lines omitted: 3>>
>> write-io system/ports/output dat length? dat
>> ...
I don't understand why you are doing it this why. Are you sure
that using just:
set-modes system/ports/output [binary: true]
insert system/ports/output read/binary %image-file.jpg
doesn't work?
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r
[5/20] from: gscottjones:mchsi at: 29-Aug-2002 18:56
From: "Gabriele Santilli"
> I don't understand why you are doing it this why. Are you sure
> that using just:
>
> set-modes system/ports/output [binary: true]
> insert system/ports/output read/binary %image-file.jpg
>
> doesn't work?
It works. My fault. Mea culpa. Ten thousand apologies. I could explain
why I went off in that direction, but there is no learning benefit to it.
So sorry.
--Scott Jones
[6/20] from: jason:cunliffe:verizon at: 29-Aug-2002 22:00
> It works. My fault. Mea culpa. Ten thousand apologies. I could explain
> why I went off in that direction, but there is no learning benefit to it.
> So sorry.
> --Scott Jones
Scott
I am still a bit confused by this thread.
Please can you post the full working script and form ?
thanks
./Jason
[7/20] from: gscottjones::mchsi::com at: 30-Aug-2002 4:26
From: "Jason Cunliffe"
> I am still a bit confused by this thread.
Me too! ;-)
> Please can you post the full working script and form ?
Certainly. Of course, you will want to change your paths and pic names.
#!/path/to/rebol --cgi -s
REBOL []
print "Content-type: image/jpeg^/"
set-modes system/ports/output [binary: true]
insert system/ports/output read/binary %//rebol/view/nyc.jpg
I creatively named the script "jpeg.cgi" and tossed it into my local website
stuff in the cgi-bin directory (if you are on a *nix, then you will need to
do a CHMOD to 755, or whatever), cranked up Apache, and cranked up IE6.0,
then typed in the url:
http://gsj/cgi-bin/jpeg.cgi
What I personally could *not* get to work (or at least to work reliably) was
the multipart/x-mixed-replace that Tim was seeking. I am beginning to
wonder if, as Graham pointed out, that this may be more of a Internet
Explorer problem than a REBOL or protocol problem. I don't currently have
any other browser installed (he says with considerable embarrassment and
wonder at why in the heck Microsoft became so insidiously and incredibly
huge). It is important to note that the "x" in the mime name means
experimental. I guess is it too experimental for Microsoft's more recent
browsers to fully and reliably support.
If there are any further questions, I would be happy to shed further
confusion. ;-)
--Scott Jones
[8/20] from: brett:codeconscious at: 30-Aug-2002 22:02
> If there are any further questions, I would be happy to shed further
> confusion. ;-)
My turn... :^)
I believe the objective is to "stream" a series of images to the browser
from a server (original source a web cam).
The multipart/x-mixed-replace is a way to deliver to the browser multiple
versions of the "same" image so that the browser should replace the image
when it receives the next part in the multipart stream.
IE apparently does not support this, for IE a activex object in the HTML
page must be used. Theoretically "other" browsers might support it directly.
My experience with Netscape so far shows promis because it does correctly
finish with the final image, but does not show the earlier images. Netscape
appears to be waiting until the connection is closed.
The problem I think is that my REBOL script does not send any data to the
browser until it quits. I've tried setting the mode of the output port to
no-wait, but no change. Can someone solve this?
Anyway, Tim, you'll probably have the ActiveX so this script might help you
out by having something to compare with.
I'm using three small gifs, but the principal should be the same as for the
web cam.
Things to watch:
(1) Line endings. Note how I've set binary mode on for all my output.
Therefore I need to supply the network standard line ending of CRLF.
(2) Line endings again. Number of line endings between headers and content.
Here's my work so far:
--8<----- The HTML page ---------------------
<html>
<body>
<h1>multipart/x-mixed-replace</h1>
<center>
<img border="1"
src="http://localhost/cgi-bin/pushtest.r.cgi"
height="37" width="37" alt="Streamed Image">
</center>
</body>
</html>
--8<----- The CGI script ---------------------
#!E:/Downloads/Languages/Rebol/Experimental/core2503031 -cs
REBOL [
Title: {Server Push CGI Test}
Author: {Brett Handley}
Date: 29-Aug-2002
Comment: {
See http://wp.netscape.com/assist/net_sites/pushpull.html
}
]
if error? err: try [
boundary-string: "ThisRandomString"
boundary: rejoin [CRLF {--} boundary-string]
emit: func [data] [
if block? data [data: rejoin data]
insert system/ports/output data
insert system/ports/output CRLF
]
set-modes system/ports/output [binary: true]
emit [
{Content-Type: multipart/x-mixed-replace;}
{ boundary-string="} boundary-string {"}
]
emit boundary
repeat i 3 [
file-data: read/binary file: join %n [i %.gif]
emit {Content-Type: text/gif}
emit {}
emit file-data
emit boundary
write/append %pushtest.log join form now [
" " file " " length? file-data newline
]
wait 00:00:01
]
] [write/append %pushtest.log join form now [mold disarm err newline]]
QUIT
--8<----- Little script to test CGI ---------------------
p: open/direct/binary/no-wait http://localhost/cgi-bin/pushtest.r.cgi
until [
wait p
none? if not none? s: copy p [print length? s]
]
close p
--8<----- %n1.gif ---------------------
#{
47494638396125002500B30000FFFFFF0000008A8A8A454545111111EFEFEF55
55559A9A9AAAAAAABBBBBB666666DFDFDF212121CFCFCF31313176767621F904
00000000002C000000002500250000048B10C849ABBD38EBCDBBFF5C21086089
104190945D61A4A9C16E0D03A7C39C1DE81DE43ACBC30753042D30870F71AC04
1808C18DD1BC2C7C87AA45712314B494868F049E0CBADF3220E133AA01AFDBE2
7DBD01D5DC1BF3DD4B51DF07636F703E737C37326F6C37596F5237696A713883
006730646F97292B83083799803DA16F22029D95A9AAABACADAE0011003B
}
--8<----- %n2.gif ---------------------
#{
47494638396125002500B30000FFFFFF0000008A8A8A454545111111EFEFEF9A
9A9A555555CFCFCFBBBBBB767676212121AAAAAADFDFDF31313166666621F904
00000000002C00000000250025000004CD10C849ABBD38EBCDBBFF60E8218670
0CE8538856611C4420CFF2C34E8512D37C40DC8082A3470C246E8A6260A038CC
04ACC28EF660501632A8C84023085614C693E5940D1A16C4D4C09A061C07C4C4
E0468B88D04679666BFB0E02090505023D0E604073583C8789130903442A8E41
493D045694088B3C0A88895C3D0B479400A13C5AA5A7330372A500093C5EAF12
059C4B768F02286C228532B3B0060A9134A920C50127434A9921C94A330B48D1
5DAE2208D5320BD72CD0B207BD8E0C02E5E50609B9B4EBECEDEEEFF0EB11003B
}
--8<----- %n3.gif ---------------------
#{
47494638396125002500B30000FFFFFF0000008A8A8A454545111111CFCFCF55
5555666666BBBBBB2121219A9A9AEFEFEFDFDFDF313131AAAAAA76767621F904
00000000002C00000000250025000004CF10C849ABBD38EBCDBBFF60D82D8822
9CA7C388167224412CCF43C102C530EF3B618705026F2833880EC3C600F59211
443AD9008131C844D6D901D3B8020760F0B6B2C8068C374CE1219451D31386A3
B953A40B8AC7A0CD33FC440E7C3C04060A0B70303B09070A7F7008440906022B
70000244330F96980D9327077B349619085D318EA4140E3202AA1766AE210C6F
18653376200FA8170B028204871F980104B5000C0A483CB21F8209609901631F
90D23CD41F0CD733040E37C4D20902C2372EA7329E02A9AFEDEEEFF0F1F2F211
003B
}
---
Website: http://www.codeconscious.com
Rebsite: http://www.codeconscious.com/index.r
[9/20] from: gscottjones:mchsi at: 30-Aug-2002 8:08
From: "Brett Handley"
<snip>
> The problem I think is that my REBOL script does not send any data to the
> browser until it quits. I've tried setting the mode of the output port to
> no-wait, but no change. Can someone solve this?
<snip>
At first, I was trying to get around reconstituting the gif's, but I created
an error condition. I finally faithfully recreated your set-up (except for
paths and names), *shutdown and restarted* Apache, and then it worked ... at
least for the REBOL HTTP retrieval. (With my testing, I have begun to
wonder if the Windows Apache doesn't have a buglet with CGI, because I've
noticed this behavior before; just not reproducibly. ???) Now just need
that ActiveX component for IE6.0 ....
--Scott Jones
[10/20] from: brett:codeconscious at: 30-Aug-2002 23:27
Hi Scott,
I tried the shutdown and restart Apache thingy too, but it didn't give me
the streaming effect. I posted the script with a wait of 1 second but I
should have made it about 4 to 5. I hoped my little test script would
display a number of iterations corresponding to it waiting for each stream
output from the server, but it only gives one - at the end. Which is my clue
to REBOL not delivering the goods until it quits. But you are right that
behaviour could just as easily be caused by the webserver. Maybe there is
some sort option in one or the other.
Regarding the ActiveX, the article referred to by Tim points out an ActiveX
that is specific to the web cam product. I suspect there is no ActiveX for
IE that is generic to all streaming cases. (Just in case I gave the wrong
impression there.)
Regards,
Brett.
[11/20] from: brett:codeconscious at: 30-Aug-2002 23:41
> Once you opt for an ActiveX inclusive solution you may as well really
enjoy a
> modern Flash format for all its virtues.
I agree with you, but it Tim's call he has the need. For me the excercise
has been informative. :^)
Regards,
Brett.
[12/20] from: jason:cunliffe:verizon at: 30-Aug-2002 8:30
> I believe the objective is to "stream" a series of images to the browser
> from a server (original source a web cam).
<<quoted lines omitted: 6>>
> finish with the final image, but does not show the earlier images. Netscape
> appears to be waiting until the connection is closed.
Well I may go down in flames for this, but what the hell..
How about using Flash as a cross platform player? FlashMX can dynamically load
JPEG images now directly at runtime. For Webcam, polling still makes sense, but
if you really want 'push' open an XMLSocket in Flash to talk with the server.
Although called XMLSocket, it does not have to be actual XML streams. It just
means the connection stays open until closed.
Oldes' wonderful %make-swf.r can also be used a potent server-side tool in this
scheme. It can generate SWFs from images, as well as all sort so tricks to embed
Actionscript, buttons, PNGs, localConnection object, dynamic timestamps,
metadata, whatever..
http://oldes.multimedia.cz/swf/
LocalConnection is incredible. Makes it trivial to have real-time event passing
between people using flash movies, as long as they are on the same server. That
means you can be sure people are looking at the same thing at the same time..
browsing or updating image sequences etc.
Once you opt for an ActiveX inclusive solution you may as well really enjoy a
modern Flash format for all its virtues.
./Jason
[13/20] from: gscottjones:mchsi at: 30-Aug-2002 9:51
Hi, Brett
From: "Brett Handley"
> ... I hoped my little test script would
> display a number of iterations corresponding to
> it waiting for each stream output from the server,
> but it only gives one - at the end. Which is my clue
> to REBOL not delivering the goods until it quits. ...
Apparently, I did not read your email closely enough. Yes, with REBOL, I did
not get 3 "packages" (my term), but one lump payment. I have no clue what IE
does with the info, but I do recall it took about 3 seconds to finish. When
I set the wait to 3 seconds, it took over 9 seconds for the 3 packages, so I
*think* Apache is doing OK in that regard.
BTW, and possibly of no particular meaning whatsoever, yesterday I did a
search of registry, and found an entry that IE does not cache the
multipart/mixed and multipart/x-mixed-replace, I guess because the later
could be huge files. I thought it was interesting that it was there at all!
> behaviour could just as easily be caused by
> the webserver. Maybe there is
> some sort option in one or the other.
Also, btw, I my Apache did not offer the multipart/x-mixed-replace as a mime
type, so I added it to mime.types in the conf folder.
...
> I suspect there is no ActiveX for IE that is
> generic to all streaming cases. (Just in case
> I gave the wrong impression there.)
...
OK, I misunderstood. Maybe I misread, which I seem to be doing *a lot*
these days. Time for a vacation/holiday.
Finally, thanks, Brett. Your code and effort were appreciated by me. I
have no use at this time for this technique, but it is nice to keep in
practice with CGI stuff.
--Scott Jones
[14/20] from: g:santilli:tiscalinet:it at: 30-Aug-2002 15:21
Hi Scott,
On Friday, August 30, 2002, 11:26:13 AM, you wrote:
>> I am still a bit confused by this thread.
GSJ> Me too! ;-)
I think Tim is trying to send a sequence of jpeg images to the
browser, so that it looks like a video. (I wonder, wouldn't
sending a video be simpler?)
GSJ> huge). It is important to note that the "x" in the mime name means
GSJ> experimental. I guess is it too experimental for Microsoft's more recent
GSJ> browsers to fully and reliably support.
Probably, but it has been around since HTTP 1.0 specs if I recall
correctly, and probably was in the original MIME specs too. It's
something quite old, but probably since very few ever used it MS
decided it was not important. (Or maybe they have their own
incompatible way of doing the same thing...)
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r
[15/20] from: al:bri:xtra at: 31-Aug-2002 9:18
Brett wrote:
> The problem I think is that my REBOL script does not send any data to the
browser until it quits. I've tried setting the mode of the output port to
no-wait, but no change. Can someone solve this?
I believe that web servers collect all the output of a CGI program, parse
the output, and then send it to the browser/internet. There might be a
setting in the web server software, to not parse the output of CGI programs?
I hope that helps!
Andrew Martin
ICQ: 26227169 http://valley.150m.com/
[16/20] from: gscottjones:mchsi at: 30-Aug-2002 16:50
> Brett wrote:
> > The problem I think is that my REBOL script
> > does not send any data to the browser until it
> > quits. I've tried setting the mode of the output
> > port to no-wait, but no change. Can someone
> > solve this?
From: "Andrew Martin"
> I believe that web servers collect all the output of a CGI program, parse
> the output, and then send it to the browser/internet. There might be a
> setting in the web server software, to not parse the output of CGI
programs?
Hi, Andrew,
Yes, you seem to be correct.
Earlier, I looked at documentation about this "problem," and it was not to
be a particular problem with earlier versions of Apache. On a lark, I
decided to try the proposed fixes, which meant doing two things. Change the
name of the script to begin with "nph-" meaning non-parsed-headers (or
something like that). Second, because the headers are not parsed, one must
then send the appropriate headers (namely, "HTTP/1.1 200). I was successful
in using a multipart/x-mixed-replace for a "streamed" text, and IE6 even
showed the document! Brett's 3 gif cgi also "showed" up as all three gifs,
but the characters, not the pictures. Then when embedded in an html page as
an IMG, it downloaded the info, but no pic ever showed up. REBOL as an HTTP
client downloaded similar content, but it was again, sent as one final
package, not as three parts in a stream. So, at least I could not get it to
work much better. I was pleased to at least see the text-only model print
anything at all!
Thanks for the additional input.
--Scott Jones
[17/20] from: brett:codeconscious at: 31-Aug-2002 11:10
> Earlier, I looked at documentation about this "problem," and it was not to
> be a particular problem with earlier versions of Apache. On a lark, I
> decided to try the proposed fixes, which meant doing two things. Change
the
> name of the script to begin with "nph-" meaning non-parsed-headers (or
Didn't know about nph - fancy a silly little prefix having such a large
impact :^)
What I did find out though in the docs for Apache 1.3 (which I'm using) is
that the output from CGI is unbuffered anyway.
So I gave up with Apache and created a little dedicated REBOL websever based
on webserver.r. This little script ignores the request and just outputs
three images in sequence just like the CGI was doing.
Edit the HTML and make the SRC of IMG to point to http://localhost:8000/ and
run the script below in CORE 2.3 (I didn't know how to update it to latest
core with the changes to networking - another thing on my learing to do
list). What you get in Netscape is a sequence of three images yippee!
1) It would be nice to know how to update this script to the latest Core.
2) This little script proves to me that the content is right for the CGI but
not the iteraction between REBOL and Apache for unbuffered output. A
mystery.
Regards,
Brett.
REBOL [
Title: "Serve Stream"
Date: 10-June-2000
File: %serve-stream.r
Purpose: {
built on webserver.r to test streaming images.
}
]
images: [
#{
47494638396125002500B30000FFFFFF0000008A8A8A454545111111EFEFEF55
55559A9A9AAAAAAABBBBBB666666DFDFDF212121CFCFCF31313176767621F904
00000000002C000000002500250000048B10C849ABBD38EBCDBBFF5C21086089
104190945D61A4A9C16E0D03A7C39C1DE81DE43ACBC30753042D30870F71AC04
1808C18DD1BC2C7C87AA45712314B494868F049E0CBADF3220E133AA01AFDBE2
7DBD01D5DC1BF3DD4B51DF07636F703E737C37326F6C37596F5237696A713883
006730646F97292B83083799803DA16F22029D95A9AAABACADAE0011003B
}
#{
47494638396125002500B30000FFFFFF0000008A8A8A454545111111EFEFEF9A
9A9A555555CFCFCFBBBBBB767676212121AAAAAADFDFDF31313166666621F904
00000000002C00000000250025000004CD10C849ABBD38EBCDBBFF60E8218670
0CE8538856611C4420CFF2C34E8512D37C40DC8082A3470C246E8A6260A038CC
04ACC28EF660501632A8C84023085614C693E5940D1A16C4D4C09A061C07C4C4
E0468B88D04679666BFB0E02090505023D0E604073583C8789130903442A8E41
493D045694088B3C0A88895C3D0B479400A13C5AA5A7330372A500093C5EAF12
059C4B768F02286C228532B3B0060A9134A920C50127434A9921C94A330B48D1
5DAE2208D5320BD72CD0B207BD8E0C02E5E50609B9B4EBECEDEEEFF0EB11003B
}
#{
47494638396125002500B30000FFFFFF0000008A8A8A454545111111CFCFCF55
5555666666BBBBBB2121219A9A9AEFEFEFDFDFDF313131AAAAAA76767621F904
00000000002C00000000250025000004CF10C849ABBD38EBCDBBFF60D82D8822
9CA7C388167224412CCF43C102C530EF3B618705026F2833880EC3C600F59211
443AD9008131C844D6D901D3B8020760F0B6B2C8068C374CE1219451D31386A3
B953A40B8AC7A0CD33FC440E7C3C04060A0B70303B09070A7F7008440906022B
70000244330F96980D9327077B349619085D318EA4140E3202AA1766AE210C6F
18653376200FA8170B028204871F980104B5000C0A483CB21F8209609901631F
90D23CD41F0CD733040E37C4D20902C2372EA7329E02A9AFEDEEEFF0F1F2F211
003B
}
]
listen-port: open/direct/lines tcp://:8000 ; port used for web connections
errors: [
400 "Forbidden" "No permission to access:"
404 "Not Found" "File was not found:"
]
send-error: function [err-num file] [err] [
err: find errors err-num
insert http-port join "HTTP/1.0 " [
err-num " " err/2 "^/Content-type: text/html^/^/"
<HTML> <TITLE> err/2 </TITLE>
"<BODY><H1>SERVER-ERROR</H1><P>REBOL Webserver Error:"
err/3 " " file newline <P> </BODY> </HTML>
]
]
emit: func [data] [
if block? data [data: rejoin data]
write-io http-port data length? data
write-io http-port CRLF 2
]
boundary-string: "ThisRandomString"
boundary: rejoin [CRLF {--} boundary-string]
buffer: make string! 1024 ; will auto-expand if needed
forever [
http-port: first wait listen-port
clear buffer
while [not empty? request: first http-port] [
repend buffer [request newline]
]
repend buffer ["Address: " http-port/host newline]
print mold buffer
mime: "text/plain"
emit [system/options/cgi/server-protocol { 200 OK}]
emit [{Server: } system/options/cgi/server-software]
emit [
{Content-Type: multipart/x-mixed-replace;}
{ boundary-string="} boundary-string {"}
]
emit {}
emit boundary
repeat i 3 [
emit {Content-Type: text/gif}
emit {}
emit pick images i
emit boundary
wait 00:00:02
]
emit {Done.}
close http-port
]
[18/20] from: tim:johnsons-web at: 30-Aug-2002 18:55
* Brett Handley <[brett--codeconscious--com]> [020830 05:58]:
> > Once you opt for an ActiveX inclusive solution you may as well really
> enjoy a
> > modern Flash format for all its virtues.
>
> I agree with you, but it Tim's call he has the need. For me the excercise
> has been informative. :^)
Hi Guys: I've been preoccupied with another project...
I don't think the client wants Flash because they don't want
the user to have to install any plug-ins.
We got a perl script running some animation, so that I could verify the
multipart scheme, so I'll give this another try tomorrow....
> Regards,
> Brett.
>
> --
> To unsubscribe from this list, please send an email to
> [rebol-request--rebol--com] with "unsubscribe" in the
> subject, without the quotes.
--
Tim Johnson <[tim--johnsons-web--com]>
http://www.alaska-internet-solutions.com
http://www.johnsons-web.com
[19/20] from: brett:codeconscious at: 31-Aug-2002 16:38
> What I did find out though in the docs for Apache 1.3 (which I'm using) is
> that the output from CGI is unbuffered anyway.
Correction. :^(
A quote:
Apache for Windows version 1.3 series is implemented in synchronous calls.
This poses an enormous problem for CGI authors, who won't see unbuffered
results sent immediately to the browser. This is not the behavior described
for CGI in Apache, but it is a side-effect of the Windows port. Apache 2.0
is making progress to implement the expected asynchronous behavior, and we
hope to discover that the NT/2000 implementation allows CGI's to behave as
documented.
Regards,
Brett.
[20/20] from: gscottjones:mchsi at: 31-Aug-2002 5:57
Hi, Brett,
From: "Brett Handley"
> Edit the HTML and make the SRC of IMG
> to point to http://localhost:8000/ and run the
<<quoted lines omitted: 3>>
> learing to do list). What you get in Netscape
> is a sequence of three images yippee!
Cool!
> 1) It would be nice to know how to update
> this script to the latest Core.
> 2) This little script proves to me that the
> content is right for the CGI but not the
> iteraction between REBOL and Apache
> for unbuffered output. A mystery.
The mysteries do abound.I was having trouble figuring out whether it was
REBOL or Apache, but you have likely said it best, that it is the
interaction of the two.
I forgot to mention that the nph- issue was written in regard to Apache
0.8!!! I am using 1.3.26, so it seemed like a long shot. There was one
other snippet in that advisory that I now cannot recall very well (I've
slept since then...), but it said how to have Apache send a raw transmission
kind of like as a pass-thru. Of course that was 0.8, and we are up to 1.3,
and 2.0 is out there, so who knows whether it would still work. But an
untouched pass-through of cgi might work. I guess when Tim get's back to
work on this aspect, it might be fun to explore a bit more.
Good job, Brett. You get the persistence award for the week.
--Scott Jones
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted