Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
It's funny.  Laugh.

Httpd Written In Postscript? Shell? 108

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 ;)
This discussion has been archived. No new comments can be posted.

Httpd Written In Postscript? Shell?

Comments Filter:
  • by yiegie ( 59764 ) on Friday April 21, 2000 @11:17PM (#1117513)
    I've heard some people are building an entire operating system in LISP [gnu.org]

    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.. ;)
  • by Anonymous Coward

    Hey guys
    Any voulonteers for writing a web server in TeX?

    P.S. Assembly?

  • by 3247 ( 161794 )

    Hey, what's so weired about that? Some people even wrote one in C.

  • by Anonymous Coward
    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
  • by Anonymous Coward
    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.
  • by Mignon ( 34109 ) <satan@programmer.net> on Friday April 21, 2000 @11:37PM (#1117520)
    "To install it, run from inetd:"

    8080 stream tcp nowait nobody /usr/bin/gs gs -dNODISPLAY -q \
    /home/pugo/src/postscript/pshttpd/pshttpd.ps

    Here's the source, in case the server gets PSDotted:

    %! %================================================= == % PS-HTTPD V1.0 %
    Copyright 2000 Anders Karlsson, pugo@pugo.org % License: GNU General Public License
    %=============================================== ==== /get_file % read file /infile
    and send it to %stdout { /buff 2048 string def { % loop infile buff readstring { stdout exch writestring
    } { stdout exch writestring infile closefile exit } ifelse } bind loop } def /read_command % read
    command from stdin and define it to /command { /stdin (%stdin) (r) file def /inbuff 256 string def
    stdin inbuff readline pop /command exch def } def /concatstr % (a) (b) -- (ab) { /beta exch def /alfa
    exch def /buffer 1024 string def alfa buffer copy pop buffer alfa length beta putinterval buffer (\000)
    search pop exch pop exch pop } def /hitcount { /hitfile (/usr/local/psweb/hits) (r) file def /hits 16
    string def hitfile hits readstring pop hitfile closefile /hitfile (/usr/local/psweb/hits) (w+) file def cvi 1
    add hits cvs hitfile exch writestring hitfile closefile } def /print_header { stdout (HTTP/1.0 200
    OK\n\n) writestring % stdout (Server: PS-HTTPD/1.0\n) writestring % stdout (Content-type:
    text/html\n) writestring } def /parse_result { command token { (GET) eq { ( ) search { root exch
    concatstr % build path /filename exch def pop pop % define filename and clean stack filename
    filename length 1 sub 1 getinterval (/) eq { filename (index.html) concatstr /filename exch def } if %
    add index.html filename (..) search { stdout (4711 Stupid user error!\n\n) writestring quit } if pop
    filename /infile exch (r) file def % open file print_header get_file } if } if } if } def % Init
    environment /stdout (%stdout) (w) file def /command () def % Root-path (root of WWW-pages)
    /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
  • by Morbid Curiosity ( 156888 ) on Friday April 21, 2000 @11:38PM (#1117521)
    "... 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 :-)
  • by oyvindmo ( 28617 ) on Friday April 21, 2000 @11:40PM (#1117522) Homepage
    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/ [assurdo.com]. These things warm my heart. *happy sigh*
  • Wowza!!!

    LISP......heh!! What will they think of next!!
  • 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...
  • Yo do realize the magnitude of the sin you have just committed?

    For punishment, you shall be sacrificed at the altar of tux!!

  • by Anonymous Coward on Friday April 21, 2000 @11:52PM (#1117526)

    At the asmutils [linuxassembly.org] 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?
  • by Anonymous Coward on Friday April 21, 2000 @11:55PM (#1117528)
    (repost; better formatted)

    A modestly ugly HTTP server written in emacs lisp.

    ;;; Luke's Emacs Webserver ("LEW" aka "Loo" aka any toilet joke you please)
    ;;; Copyright (C) 1998-1999 Luke Gorrie
    ;;;
    ;;; This program is free software; you can redistribute it and/or
    ;;; modify it under the terms of the GNU General Public License
    ;;; as published by the Free Software Foundation; either version 2
    ;;; of the License, or (at your option) any later version.
    ;;;
    ;;; This program is distributed in the hope that it will be useful,
    ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
    ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    ;;; GNU General Public License for more details.
    ;;;
    ;;; You should have received a copy of the GNU General Public License
    ;;; along with this program; if not, write to the Free Software
    ;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

    ;;; TODO list:
    ;;; support HEAD requests
    ;;; add some sort of dynamic content facility, either for elisp `servlets' or cgi

    ;;; $Id: http-server.el,v 1.2 1999/07/01 19:01:06 luke Exp luke $

    (setq http-hits 0)

    ;;; configuration

    (setq http-404-message
    (concat "File not found."
    "File not found"
    "

    "
    "The file requested does not exist, or is not a regular file, "
    "or something."
    ""))

    ;; regex path -> mime-type mappings
    (setq mimetypes-alist
    '(("\\.gif" .
    "image/gif")
    ("\\.jpg" .
    "image/jpeg")
    ("\\.png" .
    "image/png")
    ("\\.\\(el\\|txt\\|erl\\|scm\\)" .
    "text/plain")
    ("\\.html" .
    "text/html")
    ("\\.\\(tar\\|gz\\|tgz\\|zip\\|exe\\|pdf\\|ps\\)" .
    "application/octet-stream")))

    ;; document root directory
    (setq document-base "/mnt/baked/www/vegetable.org")

    ;;; http server code

    ;; open a socket to the connection-connector with a transaction callback to
    ;; serve the request when it arrives
    (defun offer-http-service ()
    (let ((service-successful nil))
    (unwind-protect
    (progn
    (lexical-let ((proc (open-network-stream "bar" "baz" "localhost" 8012)))
    (set-process-sentinel proc 'http-sentinel)
    (let ((tq (tq-create proc)))
    (tq-enqueue tq "" ".*\r\n\r\n" "Http Connection"
    #'(lambda (closure answer)
    (lexical-let ((answer answer))
    (handle-http-request proc answer))))))
    (setq service-successful t))
    (if (not service-successful)
    (progn (offer-http-service) (message "service failed"))))))

    ;; called if there's an error in between offer-http-service
    ;; and handle-http-request -- usually when the connection is broken
    (defun http-sentinel (proc sentinel)
    (offer-http-service))

    ;; read a file as a string
    (defun filestring (filename)
    (save-excursion
    (switch-to-buffer "*loading-work*")
    (insert-file-contents filename)
    (let ((contents (buffer-string)))
    (kill-buffer "*loading-work*")
    contents)))

    (defun process-send-file (process filename)
    (save-excursion
    (switch-to-buffer "*loading-work*")
    (insert-file-contents filename)
    (mark-whole-buffer)
    (process-send-region process (point) (mark))
    (kill-buffer "*loading-work")))

    ;; returns the file length
    (defun load-file-for-io (filename)
    (save-excursion
    (switch-to-buffer "*loading-work*")
    (insert-file-contents filename)
    (mark-whole-buffer)
    (- (mark) (point))))

    (defun send-current-file (process)
    (save-excursion
    (switch-to-buffer "*loading-work*")
    (mark-whole-buffer)
    (process-send-region process (point) (mark))
    (kill-buffer "*loading-work*")))

    ;; handle a http request. Takes a process and request with headers,
    ;; and sends the response
    (defun handle-http-request (proc request)
    (unwind-protect
    (progn
    (string-match "\\( \\)\\(.*\\)\\( \\)" request)
    (let ((r-path (concat document-base (match-string 2 request))))
    (message r-path)
    ;; append "index.html" to and directory name
    (if (string-match "/$" r-path)
    (setq r-path (concat r-path "index.html")))
    ;; protect against accessing ../../ to get above document base
    (if (string-match "\\.\\." r-path)
    (setq r-path (concat document-base "/index.html")))
    ;; file exists?
    (if (file-regular-p r-path)
    (let ((length (load-file-for-io r-path)))
    (message "request")
    (process-send-string
    proc (concat "HTTP/1.0 200 OK\r\n"
    "Content-Type: "
    (get-mimetype r-path mimetypes-alist "text/html")
    "\r\n"
    "Content-length: "
    (number-to-string length) "\r\n"
    "Server: " (version) "\r\n"
    "Last-Modified: " (current-time-string) "\r\n"
    "Connection: close\r\n"
    "\r\n"
    ))
    (send-current-file proc))
    ;; not a regular file
    (process-send-string
    proc (concat "HTTP/1.0 404 Not Found\r\n"
    "Connection: close\r\n"
    "Content-Type: text/html\r\n"
    "\r\n"
    http-404-message)))
    (delete-process proc)
    (setq http-hits (+ 1 http-hits)))))
    (offer-http-service))

    ;; show number of hits
    (defun show-http-stats ()
    (message (concat "HTTP hits: " (number-to-string http-hits))))

    ;; determine the mimetype of path
    (defun get-mimetype (path map default)
    (if (eq map nil)
    default
    (let ((element (car map)))
    (if (string-match (car element) path)
    (cdr element)
    (get-mimetype path (cdr map) default)))))

  • The Dude has spoken.
  • Is it just me, or is everything except Slashdot slashdotted?

    --
    You're full of crap, Fry! *bzzt* You make a persuasive argument, Fry!

  • by David A. Madore ( 30444 ) on Saturday April 22, 2000 @12:07AM (#1117531) Homepage

    While we're talking about HTTPD's written in various languages, the W3 Consortium [w3.org] has written a free (as in speech) HTTPD entirely in Java for maximal portability: Jigsaw [w3.org] (see also the Jigsaw test site [w3.org] — 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?

  • Somewhere I still have a Jupiter Ace... it's probably being kept company by my Sinclair QL, ZX81 and Philips CP/M machine. Shhh, I've just uncovered the fabled computer graveyard.
  • Sad... Y'know, I just bet this'll be moderated as 'Troll'. It really doesn't deserve troll status. Here's a couple of tips:

    1. Don't be so fscking obvious. This is about 0.0001% more talented than 'Linux sux'.
    2. Adding 'Thank you' to the end of trolls works for grits boy. Don't try and rip it off, it's pathetic.

    Hey, Rob, why isn't there a 'stupid' moderation option?
  • by David A. Madore ( 30444 ) on Saturday April 22, 2000 @12:18AM (#1117534) Homepage

    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

  • Running it under Ghostscript is cheating. Now, if you could actually run a web-server from a Postscript printer, that would impress me ...!

  • by Anonymous Coward
    Hey, Rob, why isn't there a 'stupid' moderation option? There doesn't need to be, it's already assumed.
  • by Nilz ( 175429 ) on Saturday April 22, 2000 @12:30AM (#1117537)

    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!

  • Anybody read Snow Crash recently?...
  • Writing a web server in sh-style shell is relatively easy. Here's mine:

    bash-httpd [umbc.edu]

    But writing one is postscript is cool. :)

  • Hi,

    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 /.ted page.


    It's... It's...
  • by Megane ( 129182 ) on Saturday April 22, 2000 @01:19AM (#1117541)
    Later model Apple Laserwriters do have an Ethernet port, but no TCP/IP stack that I am aware of. Would it be cheating to set up a protocol proxy to translate TCP/IP into PAP (Printer Access Protocol)? Would it be cheating to also translate the request into a Postscript command?

    But the real problem with running it on a real printer is that older (pre-EnergyStar) laser printers suck electricity like crazy. Once I decided to leave my Laserwriter (a IIntx at the time) on continously for a whole month. At the time I lived in a small apartment, with a $35/mo average electric bill, and leaving the printer on caused it to jump by about $20!
  • 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...
  • The student-network where my server lives has some serious problems with a switch, which causes about 10 seconds of downtime every minute. We have phoned the responsible people and hope they will reset the switch. Sorry about that!
  • Of course it's cheating, as I say on the webpage. The problem is that there aren't any support for TCP/IP in normal Postscript. Maybe I should mail Adobe and tell them that they should add support for TCP/IP in next version of Postscript.
  • I have a LaserWriter II with a IIg board in it, and I'm pretty sure that it drops to a low power mode after being idle for 5 minutes or so, since the fuser goes cold, and after an extended period the printer takes a minute or two to print something, needing to warm up first.
    I seriously would recommend getting yourself a IIg, as it has an Ethernet port and far better print quality than the IIntx.
    I actually find it amazing that Apple was able to produce a print engine (the LaserWriter II) that sold for 8 or 9 years, though 5 I/O board revisions, before finally being retired, and that a IISC (1 Meg of Ram, Postscript 1) can be upgraded to a IIf (up to 32 megs of RAM, Ethernet and Postscript II) by a simple I/O board swap.
  • 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.
  • There used to be a printer just about next door that had its own ip-stack and webserver... I only saw one webpage from it, a status-page basically... what brand was it again? T'wasn't a HP...
  • by kijiki ( 16916 ) on Saturday April 22, 2000 @02:04AM (#1117548) Homepage
    Man, trying to secure a httpd written in sh is gonna suck. Just for starters, try:
    http://jester.vip.net.pl:8081/../../../../../../ ../../../../etc/passwd

    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!
  • by hargettp ( 74445 ) on Saturday April 22, 2000 @02:18AM (#1117549)
    I use to run Jigsaw at home to serve up various documents on my network and to test server-based programming (Perl/CGI, Java servlets, etc.).

    As a positive, Jigsaw is a feature rich server.

    - Permits configuration of MIME types, content negotiation

    - Security-based access to selected resources (not SSL--just standard HTTP USER and PASSWORD authentication)

    - A Java-based admin tool suitable for remote administration

    - Support for virtual servers

    - Enables server-side processing, such as server side includes, CGI (through executables or through interpreters such as Perl), servlets, and a form of page scripting that allowed Java to be embedded in HTML (pre-JSP), among other techniques.

    - Conformance to current specifications.

    Eventually, I've abandoned Jigsaw, preferring either Apache or Tomcat. Here are my reasons:

    - Performance. Although Jigsaw is not abominable, this was never a fast server.

    - Frequent hangs. Although it is possible this was a WinNT issue, I found Jigsaw would frequently hang, often while serving images (?) for a document. On NT it would hang so badly Windows Explorer itself would no longer be able to display images for Web Folders unless I rebooted.

    - An arcane architectural model. Jigsaw has a very powerful yet very abstract design based upon resources, frames, and filters. Sure, that was great for providing nearly limitless ways of customizing it's behaviour, but it was pretty hard to figure out what type of class to extend in order to customize the server. Frankly, servlets +JSP+all else Java give me just about all the customization I need.

    - Slow integration with non-W3C standards. That's definitely a whine, but Jigsaw was usually a fraction of a step behind Sun's latest servlet spec, and took forever to adopt JSP in place of it's own Java-in-HTML service (although I did like their implementation). In fairness, this has been simply because W3C hasn't had resources for more than 1 or 2 people to handle the code, and the original author has unfortunately moved on from the W3C.

    So, I haven't found Jigsaw worth running on a regular basis, but I will leave you with this: there's a *heck* of a lot of free code inside that server, so if nothing else one can learn from their design and even borrow some bits (haven't checked the license recently) for other projects. Good source of samples for Java network programming.

    My $.02
  • 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 [xmlterm.com] 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 [uni-hamburg.de].

    Oh, and by the way: Symbolics [symbolics.com] (the company) is currently developing and delivering Open Genera for Alpha-CPUs. :-)
  • I'm not sure if this is the same sh-script http server (I can't get in to the site), but muLinux [freshmeat.net] has an http server with directory listing built in ash-script (in fact, most of muLinux's apps are in ash-script) the point being that they can be edited without another machine. IMHO it's not at all pointless as many of you are saying. If you look at what muLinux has done with ash, it's really incredible and very useful. I always keep a disk with mu on hand. :)

    (I've plugged it so much, I feel compelled to say I have no vested interest in muLinux, except as a fan.)

  • The IBM Network Color Laser printer has a builtin web & ftp server. You can manage the printer via www and submit jobs via ftp. This is the OEM version of a printer made by Cannon. Not sure if the Cannon model is still available but I know the IBM model was discontinued awhile back.

    12PPM in B/W 4 in color. I put 32MB memory in it and it had it's own LPR spooler with a 480Mb (I think) HD in it. Sweet printer.
  • an httpd written in IA32 (x86) assembler for linux. It's amazingly fast, doesn't use libc (does straight kernel syscalls) and is, get this, about 750 BYTES! Yes, BYTES! Don't believe me?

    Go to http://linuxassembly.org [linuxassembly.org] and look at the asmutils package. That Konstantin is one mighty assembler wizard.

  • ...at least they didn't do it in C++
  • Somebody wrote a bc(1) replacement in... AWK! I'm not linking to it here because it was so cool that they distributed it with the package. On Debian systems it can be found in /usr/doc/awk/examples. It can even do square roots. I would like to know what its algorithms are, but talk about obfruscated... everything except the few comments are either strings of incomprehensible symbols, or strings of letters in no particular order that I can discern. Even if I did know awk, trying to understand how it works would still elicit an "awk!" from just about anyone except the author.

    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

  • until... web browser include http servers in their scripting language...

    Done. Emacs-W3 is a web browser, and an Elisp http server has been posted above.

    so warez kiddies can setup their own http servers really easily

    Heck, they could use the WinApache server for that.

  • Well, people who've been around for a while will recognize this rant. I've seen it verbatim several times before *shrug*

    Droit devant soi on ne peut pas aller bien loin...
  • "Faith that we've evolved too far: it's time to back-up to, say ... using bone chips as knives ;)"

    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 used a Lisp machine at MIT in the late 1970s.

    There were a lot of really cool things about it, but it was way ahead of its time in terms of computing power. The mouse action was so sluggish it gave me an intense prejudice against GUIs which lived on for decades.

    D

    ----
  • donno... seems like a joke to me, but whatever.
    a) Linux is a product?
    b) the famous rm 'security hole' :) so funny.
    c) the black screen argument... yeah, windowmaker == black screen. Sure. Great stuff, we get some of the best gui stuff around. The only thing that you can succesfully attack is the integration. If only both desktops would just use the _X_ copy area instead of thier own stupid ones... It would save me headaches.
  • 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
  • Remember this page [ionet.net]?
    It has implementations for "99 bottles of beer" in over 200 languages, including some really obscure ones. (trumpet winsock, turing machine, pov-ray just to mention a few).
    Have a look and laugh.
  • by darango ( 23237 ) on Saturday April 22, 2000 @04:09AM (#1117564)
    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 wrote a program to calculate the Mandelbrot set in Postscript, as well as a few simpler fractals. If you're interested, you can find them here [uwaterloo.ca].
  • no you are wrong. slashdot will often become slashdotted itself.
  • by roman_mir ( 125474 ) on Saturday April 22, 2000 @05:26AM (#1117567) Homepage Journal
    I heard about a company who wrote a graphical interface to a 4 bit operating system and called the whole thing NT Server!
  • 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.
  • Indeed. All too often, we see the Recursive Slashdot Problem... slashdotters attract more people to slashdot, and so slashdot slashdots more sites causing more slashdotters to come to slashdot, with the slashdot effect that slashdot becomes slashdotted because of the slashdot effect caused by slashdotters endlessly slashdotting on slashdot and slashdotting more sites bringing more slashdotters to the slashdotted slashdot...

    Gah, I lost my train of thought ... my brain got slashdotted! :-P

  • Lexmark printer network addapter/server cards have a tiny built in web server. This is mostly for displaying printer status and such, but they included a link to www.lexmark.com for ordering new supplies. Cute.
  • 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?

    1. C... because httpd is written in C
    2. C++... because it's OO and therefore it is better by definition.
    3. BASH... because you wanna bash competing httpd's
    4. CSH... because "csh" sounds cooler than "bash"
    5. AWK... because it represents the evolved single syllable from caveman language (cf. UF comic strip)
    6. sed... because it's all about text-processing isn't it?
    7. grep... because that's the closest thing to something you can grok...
    8. Lisp... becauspe web spelling isp so bad is soundsp like lisping
    9. ELisp... because Emacs is an operating system
    10. PostScript... because those dumb Web designers got it all backwards!
    11. Java... I mean, how else would you taut compatibility with JavaScript?!?!
    12. Visual Basic... because webpages must be visual and basic enough for people to understand
    13. Horn shell... I mean, what about all that pr0n?! (And yes this is a deliberate mispelling of Korn shell)
    14. Perl... after all, that's all the Web is: pathologically eclectic rubbish listings!
    15. Slashcode... because Slashdot is all geeks ever need on the Web!!!
  • 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.

  • Haha, excellent page. They don't seem to have a LotusScript implentation of the song though. I'll fix THAT when I go to work on Monday!
  • by Anonymous Coward
    // Fin's small httpd (h.java) (C)1999, 2000, W.Finlay McWalter. // Licence: licenced for use by anyone without limitation. // Compiling: javac h.java // Executing: java h // Features: // - works correctly on win32 & unix. // - if URL ends with "/", httpd appends "index.html". // - will send files of any length. // - binary files, such as images, are supported. // - the server is multi-threaded. // - runs ok under MS-IE5's jview runtime. // Limitations: // - hardwired to listen on port 8181. // - document base is 'current' directory. // - very basic error handling - sends 404. import java.net.*;import java.io.*;import java.util.*;public class h extends Thread{Socket c;public h(Socket s){c=s;start();}public static void main(String[]a){try{ServerSocket s=new ServerSocket( 8181);while(true){new h(s.accept());}}catch(Exception e){}}public void run(){try{DataInputStream i=new DataInputStream(c. getInputStream());DataOutputStream o=new DataOutputStream(c. getOutputStream());try{while(true){String s=i.readLine();if((s== null)||(s.length()==0))break;if(s.startsWith("GET" )){if(s==null) throw new Exception();StringTokenizer t=new StringTokenizer(s," "); t.nextToken();String p=t.nextToken();p=(".".concat(((p.endsWith("/" ))?p.concat("index.html"):p))).replace('/',File.se paratorChar);int l=(int)new File(p).length();byte[]b=new byte[l];FileInputStream f= new FileInputStream(p);f.read(b);o.writeBytes("HTTP/1. 0 200 OK\n"+ "Content-Length: "+b.length+"\n\n");o.write(b,0,l);}}}catch( Exception e){o.writeBytes("HTTP/1.0 404 ERROR\n\n\n");}o.close();} catch(Exception e){}}}
  • To avoid security holes in shell scripts the main trick is to always put argument expansions inside double quotes. Doing this would fix the abovementioned reverse-DNS hack, among others.

    Blocking the .. snooping would also be pretty easy - just add a little switch statement.

    Along the same lines as these servers, here's my web server in 150 lines of C [acme.com]. It's more featureful than these - it does index.html, and even directory listings.

  • by dildog ( 128835 ) on Saturday April 22, 2000 @07:31AM (#1117578) Homepage
    I wrote this thing a while back to serve files on and off of a machine when a Word document is opened. Try downloading this, and running it with macros enabled. Then browse to your own port 80. If you don't trust word macros, take a look at the source first with the visual basic editor. Requires Office 2000, but will work with Office 97 if you convert it down.

    http://www3.l0pht.com/~dildog/webserver.doc [l0pht.com]

    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!
  • I hear excite is using Tomcat is that right? Do you have link to tomcat I'd like to check it out.
  • Why don't you try it and report back to the class?
  • 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.
  • Tomcat [apache.org], from The Apache Group, is really the 100% Java reference implementation of Java Server Pages and servlets. The included web server is very simple but effective, since you can throw in just about any logic in a servlet or JSP to customize the processing.
  • Wonder if Microsoft will sue them..
  • %!OPS-1.0 %%Creator: HAYAKAWA,Takashi

    /A/copy/p/floor/q/gt/S/add/n/exch/i/index/J/ifel se/r/roll/w/div/H{{loop}stopped
    Y}def/t/and/C/neg/T/dup/h/exp/Y/pop/d/mul/s/cvi/ e/sqrt/R/rlineto{load def}H 300
    T translate(V2L&1i2A00053r45hNvQXz&vUX&UOvQXzFJ!FJ!J !O&Y43d9rE3IaN96r63rvx2dcaN
    G&140N7!U&4C577d7!z&&93r6IQO2Z4o3AQYaNlxS2w!!f&n Y9wn7wpSps1t1S!D&cjS5o32rS4oS3o
    Z&blxC1SdC9n5dh!I&3STinTinTinY!B&V0R0VRVC0R!N&3A 3Axe1nwc!l&993dC99Cc96raN!a&1CD
    E&YYY!F&&vGYx4oGbxSd0nq&3IGbxSGY4Ixwca3AlvvUkbQk dbGYx4ofwnw!&vlx2w13wSb8Z4wS!J!
    c&j1idj2id42rd!X&4I3Ax52r8Ia3A3Ax65rTdCS4iw5o5Ix nwTTd32rCST0q&eCST0q&D1!&EYE0!J
    &EYEY0!J0q!x&jd5o32rd4odSS!K&WCVW!Q&31C85d4!k&X& E9!&1!J!v&6A!b&7o!o&1r!j&43r!W)
    {( )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 ...
  • Actually, the AC's example will work. Try

    foo="`/bin/ls`"
    echo "stuff $foo stuff"

    The real trick is to never, ever subject user-supplied input to a shell eval. This is one of the reasons I never, ever use the csh (among other things, it implicitly does an eval on variables like HOME, TERM, and USER when the shell is invoked).
  • I love that page. Hopefully the slashdoting it recieves is appreciated by the owner.
  • Yeah! One of the Guys I work with is a contributor to this project! Weird and cool...
  • dang sed s/slashdot/geek on this post and JonKatz has a new article:)
  • 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.
  • The hard part about using a printer's PS engine to execute it would be that most printers PS engines are seperate from their IO engines. The IO engines will pass your code to the PS interpreter for execution, but once you got the server running how would you get requests to the server?

    Even if there was some way for the executing PS code to get additional data AND you could get something approximating an HTTP request to the printer through the IO engine's print server, there's probably no way to get the data back from the program -- the IO engine probably can get "I'm can't render this" messages back from the PS engine and that's about it. I suppose you could actually PRINT the replies, but would that enable the code to keep running?

    What this makes me think wonder is: why are there no Postscript compilers? You would think that it might make sense to compile postscript to a faster native machine code than to simply interpret it. I'd bet that a lot of printer-driver generated postscript throws in a lot of the same code for print jobs that could be compiled, the object code cached, and re-used for subsequent jobs. OrNot.
  • "I have trouble believing this. There would be no quality control, no sterile conditions, etc."

    Just because you've got a person from an unsterile place not renowned for its quality countrol doesn't mean you can't take that artisan somewhere else to do his work, and subject it to quality control.

    "Furthermore, the knowledge to flake blades is alive and well. There are amateurs, including some very skilled archaeologists who want to understand how primitive peoples made points, who have such skill that they can fool experts."

    I didn't say it was dead - however, the skill level needed to fool experts as to the authenticity of archaeological specimens would probably not be as high as that needed to make blades for surgery, would it?
  • ...to interpret printer http requests and serve web pages to printers. After all, printers need to surf too!!
  • "... it's time to back-up to, say ... using bone chips as knives"

    I take this to mean that writing an httpd in shell script is backing up.

    It's actually just the opposite. It's a step up to a higher level language than c, which is what they are most frequently writing them in these days.

    Now writing one in PS is just plain wack. :)

  • All Laserwriter II models use the same engine. The engine is the problem. It was not designed to have a power saving mode. OTOH, Apple has made at least one model of printer (the Personal LW 600, I think -- whatever it is, it's a QuickDraw printer) that doesn't even have a power switch!

    And yes, I do have a IIg board now. That's why I said it was a IIntx back then. In fact, I now have two spare IInt printers and passed up another because they are so old they show up cheap (like $15-20!) at thrift stores these days.
  • I've heard some people are building an entire operating system in LISP
    So? I've heard that several operating systems are written in C. That's far beyond weird and funny :)
  • Listen dude, *I* come from Holland, so *I* have an excuse. You should be glad that I am able to talk English anyway.

    *You* have NO excuse for talking the way you do. Offensive language, and even anonymous. You're even a lower life form than those that call you anonymously by telephone to offend you.

    Furthermore, my question was *not* "what is the plural of virus?" and as it seems, I don't seem to be the only confused around here (see your own link), so I think "fucking bitch as nigga" is a little bit overdone!

    Now smart ass, *answer my question* or die silent, please.


    It's... It's...
  • I have two working Symbolics Lisp machines to give
    away for free in Hamburg/Germany. I will
    even ship in northern Germany to get a new home
    for them now that I'm moving to a smaller house.

    Martin Cracauer cracauer@seagull.cons.org
  • Just because you've got a person from an unsterile place not renowned for its quality countrol doesn't mean you can't take that artisan somewhere else to do his work, and subject it to quality control.

    If you take the artisan somewhere else and subject his work to quality control, then it's art no longer.
  • Easy:

    `r`.n`.e`.d`.d`.i`.b`.r`.o`.F`. `.3`.0`.4i

  • 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.
  • Somewhere I still have a Jupiter Ace... it's probably being kept company by my Sinclair QL

    I can do better than that. Although I never had a QL, I do have a BT Merlin Tonto phone. It's basically a QL with a handset bolted onto the side! Complete with twin microdrives and all. It's very cool having a phone that you can program (even if it is in basic). It also had a great UI. Pick up the phone and type a 3 digit mnemonic representing whoever it is you want to call, and it dials the number for you. I just wish there was a modern equivalent...

  • 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?
  • 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?
  • Writing a web server in sh or Postscript is a very wizardly feats. To be truly sick, however, your project must be written in Intercal [tuxedo.org].
    • Everything written in LISP. History repeats...

    Not repeats, recurses ...

    darren


    Cthulhu for President! [cthulhu.org]
  • I, too, have been informed (when I worked at the Exploratorium) that napped obsidian blades are used for surgery. The reason given was that obsidian can be napped down to monomolecular edges. These are, of course, incredibly fragile. Obsidian can be napped absolutely smooth (no burs), because it naps along a grain. In obsidian the grain is curved, so you get a scalpel-shape naturually. I see no reason they wouldn't be easy to sterilize: obsidian is volcanic glass, and as easy to sterilize as a test tube.

    As it happened, while I was working in the Exploratorium, they had an obsidian napper as a guest artist a couple of times. Intrigued by this idea, I used a couple of his shards -- not blades, just leftovers -- to perform an eye dissection. They worked quite well.

    As to whether they are actually being used, or who would be manufacturing them, I could not say.

    FYI, for Stephenson fans: I have also done stained glass work, and broken/cut/ground a fair amount of window glass. Normal window glass doesn't have much of a grain, and I don't think it can be napped worth a damn. It's not like obsidian at all.
    ----------------------------------------------

Been Transferred Lately?

Working...