version 1.5, 2000/04/12 20:53:46
|
version 1.9, 2000/11/19 21:42:05
|
Line 1
|
Line 1
|
#! /usr/local/bin/gforth |
#! /usr/local/bin/gforth |
|
|
|
\ Copyright (C) 2000 Free Software Foundation, Inc. |
|
|
|
\ This file is part of Gforth. |
|
|
|
\ Gforth 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, USA. |
|
|
warnings off |
warnings off |
|
|
include string.fs |
require string.fs |
|
|
Variable url |
Variable url |
Variable posted |
Variable posted |
Line 187 s" text/plain" transparent: txt
|
Line 205 s" text/plain" transparent: txt
|
|
|
\ http server 26mar00py |
\ http server 26mar00py |
|
|
|
Defer redirect? ( addr u -- addr' u' t / f ) |
|
Defer redirect ( addr u -- ) |
|
:noname 2drop false ; IS redirect? |
|
|
: http ( -- ) get-input IF .nok ELSE |
: http ( -- ) get-input IF .nok ELSE |
IF url $@ 1 /string rework-htmldir |
IF url $@ 1 /string 2dup redirect? IF redirect 2drop ELSE |
|
rework-htmldir |
dup 0< IF drop .nofile |
dup 0< IF drop .nofile |
ELSE .ok 2dup >mime mime search-wordlist |
ELSE .ok 2dup >mime mime search-wordlist |
0= IF ['] txt THEN catch IF maxnum off THEN |
0= IF ['] txt THEN catch IF maxnum off THEN |
THEN THEN THEN outfile-id flush-file throw ; |
THEN THEN THEN THEN outfile-id flush-file throw ; |
|
|
: httpd ( n -- ) maxnum ! |
: httpd ( n -- ) maxnum ! |
BEGIN ['] http catch maxnum @ 0= or UNTIL ; |
BEGIN ['] http catch maxnum @ 0= or UNTIL ; |
Line 206 script? [IF] :noname &100 httpd bye ; i
|
Line 229 script? [IF] :noname &100 httpd bye ; i
|
type cr refill 0= UNTIL EXIT THEN |
type cr refill 0= UNTIL EXIT THEN |
nip source >in @ /string rot - dup 2 + >in +! type ; |
nip source >in @ /string rot - dup 2 + >in +! type ; |
: <HTML> ( -- ) ." <HTML>" $> ; |
: <HTML> ( -- ) ." <HTML>" $> ; |
|
|
|
\ provide transparent proxying |
|
|
|
include proxy.fs |