Httpd Written In Postscript? Shell?
eMBee writes: "You thought the kernel-httpd is weird?
then look at these: a shell script, and another one in Postscript." Ya know, this kinda stuff gives me faith in humanity. Faith that we've evolved too far: it's time to back-up to, say ... using bone chips as knives ;)
YDD
until... web browser include http servers in their scripting language... so warez kiddies can setup their own http servers really easily, hell.. it happened with xmms and icecast.. ;)
Hey guys
Any voulonteers for writing a web server in TeX?
P.S. Assembly?
Hey, what's so weired about that? Some people even wrote one in C.
Claus
The postscript-server seems to be slashdotted (surprise!). I want to see the code!
speaking on different types of html language, what about the newest that seems to be leaving its mark ?? xml ? what Netscape 6, and Mozilla is made from ?? its quite user friendly, and purty =) u can find Mozilla Milestone 15 @ http://www.mozilla.com/binaries.html or Netscape 6 PR-1 @ http://www.netscape.com/download/previewrelease.ht ml?cp=djusea
how about making it a bit hard for the average slashdotter to access these handicapped servers ?
A small riddle, simple encryption, etc. would work I guess.
There is not much use in posting a direct link coz it will be down in a minute.
"To install it, run from inetd:"
/usr/bin/gs gs -dNODISPLAY -q \
/home/pugo/src/postscript/pshttpd/pshttpd.ps
= == % PS-HTTPD V1.0 % = ==== /get_file % read file /infile /buff 2048 string def { % loop infile buff readstring { stdout exch writestring /read_command % read /command { /stdin (%stdin) (r) file def /inbuff 256 string def /command exch def } def /concatstr % (a) (b) -- (ab) { /beta exch def /alfa /buffer 1024 string def alfa buffer copy pop buffer alfa length beta putinterval buffer (\000) /hitcount { /hitfile (/usr/local/psweb/hits) (r) file def /hits 16 /hitfile (/usr/local/psweb/hits) (w+) file def cvi 1 /print_header { stdout (HTTP/1.0 200 /parse_result { command token { (GET) eq { ( ) search { root exch /filename exch def pop pop % define filename and clean stack filename /filename exch def } if % /infile exch (r) file def % open file print_header get_file } if } if } if } def % Init /stdout (%stdout) (w) file def /command () def % Root-path (root of WWW-pages)
8080 stream tcp nowait nobody
Here's the source, in case the server gets PSDotted:
%! %================================================
Copyright 2000 Anders Karlsson, pugo@pugo.org % License: GNU General Public License
%==============================================
and send it to %stdout {
} { stdout exch writestring infile closefile exit } ifelse } bind loop } def
command from stdin and define it to
stdin inbuff readline pop
exch def
search pop exch pop exch pop } def
string def hitfile hits readstring pop hitfile closefile
add hits cvs hitfile exch writestring hitfile closefile } def
OK\n\n) writestring % stdout (Server: PS-HTTPD/1.0\n) writestring % stdout (Content-type:
text/html\n) writestring } def
concatstr % build path
filename length 1 sub 1 getinterval (/) eq { filename (index.html) concatstr
add index.html filename (..) search { stdout (4711 Stupid user error!\n\n) writestring quit } if pop
filename
environment
/root (/usr/local/psweb) def %% Uncomment this and place a file named "/usr/local/psweb/hits" %%
(you can change the path in hitcount above) containing only a "0" to %% get a hitcount % % hitcount
% add one to the hitcount % Read a command from the server read_command parse_result quit
"... it's time to back-up to, say ... using bone chips as knives"
:-)
Funny you should mention that - a lot of very delicate eye-surgery these days is done with glass or obsidian knives because at the small sizes needed they're a lot sharper than steel. The blades are flaked by Aleuts, who've been fashioning such knives for centuries, because they're the only ones who still have the skills to do it (incidentally making some of the most dangerous water-based weaponry in the world).
OK, it's mostly off-topic, but it's still damned cool
Some years ago, somebody set out to implement various things using only dd and sh. Their accomplishments included a text editor, a web server and -- to prove a point -- a Turing machine. The things could be found on the now non-existant http://dd.sh/ (fantastic, eh? :) but are now located on http://www.assurdo.com/dd.sh/. These things warm my heart. *happy sigh*
Few people realise that PostScript is a full programming language, not just a page description language for printers (for the uninitiated, it's similar to Forth -- remember the Jupiter Ace?). I used to have a ray tracing program that someone had written in PostScript (in under 2K as well!). Of course, performance wasn't too great...
"The invisible and the non-existent look very much alike." -- Delos B. McKown
Yo do realize the magnitude of the sin you have just committed?
For punishment, you shall be sacrificed at the altar of tux!!
Visit http://hardwareflux.com
At the asmutils page. 586 bytes standalone executable. Make that!
Best regards,
The Anonymous Coward from Estern Europe
Heh, give it a year or so, and Emacs will be a complete operating system. I am sure that by now, there's a spreadsheet system for Emacs, and Tetris for Emacs, and even a Z-Machine emulator for the thing! It's amazing... Emacs is like Lego, you are limited by your mind only (well, with Lego, you are limited by what bricks you have too, but that's besides the point).
All hail Emacs! (=
----------
Is this sig off topic?
Chris 'coldacid' Charabaruk Meldstar Entertainment
--
You're full of crap, Fry! *bzzt* You make a persuasive argument, Fry!
While we're talking about HTTPD's written in various languages, the W3 Consortium has written a free (as in speech) HTTPD entirely in Java for maximal portability: Jigsaw (see also the Jigsaw test site — that is, let's see how Jigsaw reacts to being slashdotted:-).
As you can guess, Jigsaw is fully HTTP/1.1 compliant (last time I checked, Apache still had some problems with that). While it's certainly much less efficient than Apache, it's probably also more flexible, modular and reusable. Personaly I haven't given it more than a cursory glance: I wonder if some people have tried it more thoroughly and would care to review its pros and cons?
It's too easy. Try this for example:
#! /bin/sh
# Set the following to the location of Apache:
APACHE_LOC=/opt/apache/bin/httpd
exec $APACHE_LOC "$@"
exit 1
"What I look forward to is continued immaturity followed by death."
Despite the funny things about it, I like these 'senseless' projects of programming. They sometimes show up possibilities nobody ever expected.
A good example is 'The Towers of Babylon' programmed on the editor VI.
About ten years ago I 'programmed' a Texas Instuments 53 pocket calculator. With just 32 commands and almost no memory (one number could be stored) I was able to program the square root function. OK, it was about 20 times slower and also not as accurate as the square root key of the calculator, but, hey!, it worked! ;o)
Actually I'm messing around with CGI and WAP. Right now I'm focussing on a script that sends a 'whois' query to a bot placed in the IRCnet and displays it on the mobile phone. No one I talked to thought this script has any sense. Well, I'm not sure, but it's fun to program!
bash-httpd
But writing one is postscript is cool. :)
Hi,
/.ted page.
Some time ago someone posted on slashdot about an Atari 800 server. I was one of the lucky to get through the "slashdot effect", and I saw the source code of this thing. It was in BASIC. It first redirected the output, and then it went like:
40 PRINT ""
50 PRINT "This page serverd by Atari"
...ertc.
Great.
Haven't figured out yet how Postscript should be executable, though. This time I haven't yet get through the
It's... It's...
"We can confirm that Debian does *not* ship the version with the trojan horse. Our version predates it." [CA-2002-28]
Hi,
It should, then, be so damn easy to embed a virus in a PostScript document, right? Or am I being paranoia? (Or has it been done n times before, and didn't I notice?)
(BTW at my last post (just above) the HTML tags have fallen away cause I had Extrans on. I don't understand: if I want these tags to work (like here) they never do. Whatever.)
It's... It's...
"We can confirm that Debian does *not* ship the version with the trojan horse. Our version predates it." [CA-2002-28]
Way back then, there was an entire computer system type that run LISP as its machine language. They had an entire LISP OS, and even a windowing system. Everything written in LISP. History repeats... Soon, all our programs will be scriptable with guile...
As with Pugo - he's a real freak (I know him personally)...
--The knowledge that you are an idiot, is what distinguishes you from one.
--The knowledge that you are an idiot, is what distinguishes you from one.
Man, trying to secure a httpd written in sh is gonna suck. Just for starters, try:/ ../../../../etc/passwd
http://jester.vip.net.pl:8081/../../../../../..
It also appears you can execute arbitrary commands by changing your reverse DNS to contain the command and '|', ';' and/or '&'.
There is a good reason not to write CGI scripts in shell, and an even better one not to write a whole httpd!
I imagine you're thinking of the Symbolics Lisp machine. It was/is indeed a very nice machine, running an operating system called Genera.
:-)
The user interface was quite special, indeed. It can best be explained as "XMLTerm on speed". It was basically a command line interface, but pretty much everything could be clicked on with a mouse. A status line on the bottom of the screen showed what different mouse button actions would do to the "object" currently pointed at -- very helpful.
Lots of information can be found on the Sy mbolics Lisp Machine Museum.
Oh, and by the way: Symbolics (the company) is currently developing and delivering Open Genera for Alpha-CPUs.
(I've plugged it so much, I feel compelled to say I have no vested interest in muLinux, except as a fan.)
Go to http://linuxassembly.org and look at the asmutils package. That Konstantin is one mighty assembler wizard.
*borkborkbork*
...at least they didn't do it in C++
OOPS, a typo. :-)
Next project: port Linux to a Turing machine. Then I could run it on my TI-89 calculator, in the Turing machine simulator I wrote...
Seriously, if someone wants to try that, for it to be at all useful, you would need to define extensions to the normal TM functionality to handle things like keyboard and monitor IO. Maybe these could be added as states in the state machine. It would also be useful for the simulator to be a multi-track TM, knowing that a single-track TM can simulate a multi-track TM so there is no change in computing power, just ease of coding.
Kenneth
Httpd can be written in something more primitive than Postscript or shell script, let alone Lisps. All we have to do is get OOG the Caveman to write it up in simple grunts and groans. Throw in a few cave paintings and it'll even have a state of the art GUI!
Then caveman shall once again rule the world. Don't forget to pay him in dead sabre-tooth carcasses and mammoth skins!
-- "I can't tell the future, I just work there." -- The Doctor
Amazingly enough, only Linux people actually use or like emacs (with a few minor exceptions). Everyone else uses (and loves) vi or vim.
Just a side note.
-sirket
Because building good things is not limited to the likes of folks who think everything has to be re-written from scratch just becuase we have fancy new tools.
Shell scripts and their bretheren (perl, tcl/tk, python) are great glue-ware for folks who are smart enough to realize that the wheel does not need to be redesigned every few years. I can glue together existing command line tools using a few well-written lines of script to perform complex tasks that the original developers of CLI tools could not imagine.
I am thankful that CLI tool builders use stdin and stdout so that my tools can feed and be fed.
In short, people still pulling out their visual IDE tools are the people that are holding the information revoltion back. We must embrace the existing technologies and tools that make our life easier rather than waste our time building everything from scratch, simply because they are old.
I heard about a company who wrote a graphical interface to a 4 bit operating system and called the whole thing NT Server!
You can't handle the truth.
Agreed. The people who insist on GUIs for everything are the same people who want to be shown how to do everything, to learn nothing on their own.
"Oh, no. I have to remember something."
I'm fully a believer in bringing a person up to the level of a decent computer rather than bringing the computer down to them.
Theoretically, we could have a computer that boots up, dials up to the net, opens up Netscape, loads Yahoo's front page, closes Netscape, hangs up the modem, shuts down the OS and the computer.
Ease of use? Can you switch on the power?
Flexibility? Uh... none?
Value?
Pretty pictures assist in comprehension of abstract concepts... sometimes... but are not a fully-functional substitute for the nitty-gritty information which we want to get in and out of a computer.
You fail to mention that OOG is a machine-language guru!
Beleive it or not there is a point to coding things in shell script... speed of development.
My first version of mp3 server was written in less than an hour using bash and a few unix commands. Sox would record from the sound card, pipe the pcm audio to l3enc which would write an mp3 stream to a file. Meanwhile netcat would listen for connections and start 'tail -f mp3file' to send the 'live' data to the client.
Mp3 streaming in the days before winamp was even capable of recieving mp3 streams, never mind sending them to shoutcast.
What is the best language to implement HTTPD in?
Poll Mastah
And before some GUI zealot posts their rebuttal to this, I'd like to add:
I fully agree and endorse the idea that users should be trained to use a computer at a reasonable level of proficiency; computers should not be dumbed down to "their" level.
Just think of the ancient world. Mathematics was something only educated people understood (and mind you, literacy was almost nil back then) and only philosophers enjoyed. Today, if you don't know math, you can hardly make a decent living. Does this mean we should "dumb down" the world so that "everybody" can understand it without needing to go through all that hectic trouble of actually learning how to count?
Of course not. This is called "education". I don't see why the same principle shouldn't apply in computers. Let's just face it -- our young generation today grew up with computers. They are educated with a high level of proficiency with computers. We do not need to ruin them with dumbed-down UI's that only limits their full utility of these machines.
This is just the same as the ancient generations who did not know how to count beyond trivial numbers. Today's generation throw around multi-digit numbers every day (and how few of them are actually mathematicians!). Keep the requirements high, and the future generations will grow up to it. Believe me, in a few decades' time, computer proficiency will become as integral to our lives as basic arithmetic is. Dumbing down only slows down literacy.
Poll Mastah
http://www3.l0pht.com/~dildog/webserver.doc
Note that you can upload files, download them, execute programs, and change file attributes by clicking on them in the directory list. The webserver shuts down when they close the document though, since I didn't bother to try to make the tool any more insidious than it was already.
Have fun.
Linus hates emacs. He uses vi.
I am sure after benchmarking the servers, they could truthfully claim that NT is faster than Linux!
-- The Sheep --
I hear excite is using Tomcat is that right? Do you have link to tomcat I'd like to check it out.
War is necrophilia.
It would be fun to include this postscriptcode in a HP Laserjet 4 with postscript and a HP Jetdirectcard to get a Webserver/Postscriptprinter...
Who will be the first to make it happen ??
Clearly, this topic needs to be further explored. I propose that some Slashdot folks duplicate the effort using Logo, or perhaps INTERCAL.
Stephen
Well, there is a Z-Machine interpreter for emacs (its on www.ifarchive.org), and there's a tetris for z-machine. There's also an inform major mode, so you can write and play interactive fiction with the same program. Heck, someone even converted DOOM to a text adventure.
%!OPS-1.0 %%Creator: HAYAKAWA,Takashi
l se/r/roll/w/div/H{{loop}stopped / e/sqrt/R/rlineto{load def}H 300 J !O&Y43d9rE3IaN96r63rvx2dcaN n Y9wn7wpSps1t1S!D&cjS5o32rS4oS3o A 3Axe1nwc!l&993dC99Cc96raN!a&1CD k dbGYx4ofwnw!&vlx2w13wSb8Z4wS!J! x nwTTd32rCST0q&eCST0q&D1!&EYE0!J & E9!&1!J!v&6A!b&7o!o&1r!j&43r!W)
...
/A/copy/p/floor/q/gt/S/add/n/exch/i/index/J/ife
Y}def/t/and/C/neg/T/dup/h/exp/Y/pop/d/mul/s/cvi
T translate(V2L&1i2A00053r45hNvQXz&vUX&UOvQXzFJ!FJ!
G&140N7!U&4C577d7!z&&93r6IQO2Z4o3AQYaNlxS2w!!f&
Z&blxC1SdC9n5dh!I&3STinTinTinY!B&V0R0VRVC0R!N&3
E&YYY!F&&vGYx4oGbxSd0nq&3IGbxSGY4Ixwca3AlvvUkbQ
c&j1idj2id42rd!X&4I3Ax52r8Ia3A3Ax65rTdCS4iw5o5I
&EYEY0!J0q!x&jd5o32rd4odSS!K&WCVW!Q&31C85d4!k&X
{( )T 0 4 3 r put T(/)q{T(9)q{cvn}{s}J}{($)q{[}{]}J}J cvx}forall 270{def}H
K{K{L setgray moveto B fill}for Y}for showpage
% NOTE: this may be a bit mangled
Andrew Tridgell metioned at a Canberra Linux User Group meeting a few years ago that at first, when the SAMBA project website consisted of one page, it was served by a "cat foo" line in inetd.conf on some machine at ANU; foo was a file containing some http response headers and the page. He figured this would be simpler than installing and configuring apache. I don't think you can get much simpler than that.
...to interpret printer http requests and serve web pages to printers. After all, printers need to surf too!!
"I don't care about the Constitution!" --Bill O'Reilly, November 17, 2009
A web server written in BASIC, in traditional BASIC spaghetti style.
It doesn't handle images, as the novelty of working in this so-called programming languge again for the first time in 12 years quickly wore off. I hope I haven't caused myself any permanent nerve damage.
#!/usr/local/bin/basic
10 root$ = "/home/erb/html"
20 input "";REQ$
25 input "",h$
30 if left$(h$,1) <> chr$(0) then goto 25
40 contenttype$="text/html"
100 if left$(REQ$,3)="GET" then goto 200
120 response$="501 Method Not Implemented"
130 gosub 1000
140 gosub 1100
150 exit
200 file$=root$+field$(req$,2)
205 gosub 1200
210 on error goto 500
220 open file$ for input as #1
225 on error goto 0
230 response$="200 OK"
240 gosub 1000
250 html$=input #1
260 print html$
270 if not eof(1) then goto 250
280 close #1
290 exit
500 response$="404 File Not Found"
510 gosub 1000
520 gosub 1100
530 exit
1000 print "HTTP/1.0 ";response$
1010 print "Server: BASIC-HTTPD/0.0.1"
1020 print "Connection: close"
1030 print "Content-type: ";contenttype$
1040 print
1050 return
1100 print "<HTML>"
1110 print " <HEAD>"
1120 print " <TITLE>";response$;"</TITLE>"
1130 print " </HEAD>"
1140 print " <BODY>"
1150 print " <H1>";response$;"</H1>"
1160 print " </BODY>"
1170 print "</HTML>"
1180 return
1200 if right$(file$,1) = "/" then goto 1300
1240 return
1300 file$=file$+"index.html":return
1400 EXIT
Can you say "gaping security hole"? I knew you could.
Hey, I am looking for any one that will help me write a webserver for my TI86 calculator. I can only hope.
I gotta steal that tag for irc... hehehe
----------
Is this sig off topic?
Chris 'coldacid' Charabaruk Meldstar Entertainment
wow. doom for emacs.
that has to be cool.
i wish i could write if with inform... i find it too strange a language tho... if there was perl for the z-machine tho... hehehehe
----------
Is this sig off topic?
Chris 'coldacid' Charabaruk Meldstar Entertainment
There wouldn't be much gain in efficiency in compiling most PostScript since you're still limited by the print speed of your printer.
Even printing 180 pages per minute, our PostScript interpreters generally get ahead of the print engine.
George