serving mp3 with httpd stack of soapdog - how to modify the server header

runrev at animabit.de runrev at animabit.de
Mon Jul 17 06:21:37 EDT 2006


Hi
Using the http daemon of soapdog at
http://homepage.mac.com/soapdog/rev/revhttpd.html
I tried to modify this stack for serving mp3 and wav sounds from a local webserver.

The modification in the stack script:
if a file with extension mp3 has been called with an URL like
http://127.0.0.1:8080/quotes.mp3
then serve the content of the property mp3data of this stack.
Before this command I have included the mp3data in the stack
set the mp3data of this stack to URL "binfile:c:/test.mp3"

case "mp3"
put the mp3data of stack "quotes" into mp3file
--put "Content-type: audio/x-mp3" & lf & lf & the mp3data of stack "quotes" into mp3file
write mp3file to socket SocketID
close socket socketID
pass serverread
break
The browser interprets the data sent as text and shows the binary file in the web browser like an html page.
I tried to put the HTML content-type before the data like in apache and perl - but because this is a feature of the apache server, this was nonsense - the line will be served to the browser of course.
My Question: How can I change the script to serve the binary data of the mp3 file in a way the browser can get it as a mp3 file and play it as a sound? How can I implement the header like apache does? (The same would be interesting for serving swf).
Regards,
Franz Böhmisch
boehmisch at animabit.de



More information about the use-livecode mailing list