Test web proxying.

This commit is contained in:
C. Guy Yarvin 2014-03-22 14:42:25 -07:00
parent 9f47123717
commit 81cc2694dd
2 changed files with 156 additions and 71 deletions

View File

@ -12,6 +12,7 @@
dop=(map host ship) :: host aliasing
own=(map ship serf) :: domestic servers
fon=(map ship rote) :: foreign servers
rox=(map duct duct) ::
ask=[p=@ud q=(map ,@ud ,[p=duct q=hiss])] :: outgoing by number
kes=(map duct ,@ud) :: outgoing by duct
== ::
@ -37,8 +38,8 @@
pez=pest :: request state
== ::
++ rote :: remote server
$: rem=[p=@ud q=(map ,@ud ,[p=duct q=httx])] :: active remotes
kut=(map duct ,@ud) :: duct returns
$: cnt=@ud :: number served
rem=[p=@ud q=(map ,@ud duct)] :: active requests
== ::
++ serf :: local server
$: pef=@t :: server prefix
@ -165,6 +166,23 @@
[[sec (rash i.u.hot thor:epur)] p.ryp q.ryp]
==
(hell pul +.fav [p.heq mah s.heq])
::
%thou :: remote return
?> ?=([@ ~] tea)
(hajj (need (slaw %p i.tea)) p.fav)
::
%wart :: remote request
?+ q.fav
~& [%strange-wart p.fav q.fav]
+.$
::
%pr
(hare r.fav p.fav s.fav)
==
::
%waft
?> ?=([%hork @ ~] tea)
(gosh p.fav (need (slaw %ud i.t.tea)) ((hard httr) q.fav))
==
::
++ doss :: host to ship
@ -183,6 +201,32 @@
^- httr
[sas ~[content-type/'text/plain'] [~ (tact str)]]
::
++ gosh :: receive %pr response
|= [him=ship num=@ud har=httr]
^+ +>
=+ rot=(need (~(get by fon) him))
=+ zer=(need (~(get by q.rem.rot) num))
~& [%gosh-hen hen]
~& [%gosh-zer zer]
%_ +>.$
mow :_(mow [wru zer [%thou har]])
fon (~(put by fon) him rot(q.rem (~(del by q.rem.rot) num)))
==
::
++ hajj :: send %pr response
|= [him=ship har=httr]
^+ +>
~& [%hajj him har]
(muff [%waft him har])
::
++ hare :: receive request
|= [tus=path him=ship hor=*]
^+ +>
~& [%hare him tus]
=+ hyx=((hard httx) hor)
~& [%hare-httx hyx]
+>.$(mow :_(mow [wru [/c/(scot %p him) hen] [%this hyx]]))
::
++ hell :: request, no ship
|= [pul=purl hyx=httx moh=moth]
^+ +>
@ -207,77 +251,115 @@
++ hork :: remote request
|= [him=ship hyx=httx]
^+ +>
=+ ^= rot ^- rote
=+ rut=(~(get by fon) him)
?^(rut u.rut *rote)
=+ num=p.rem.rot
=. +>.$
%_ +>.$
mow
:_ mow
:+ wru
[/a [%c %hork (scot %ud num) ~] hen]
[%want him [%pr ~] hyx]
::
fon
%+ ~(put by fon) him
%_ rot
cnt +(cnt.rot)
p.rem +(p.rem.rot)
q.rem (~(put by q.rem.rot) num hen)
==
==
~& [%hork him]
!!
::
++ horn :: irregular request
|= [pul=purl cip=clip moh=moth]
^+ +>
=- (fail 400 "urbit: url {<pul>} does not match a vessel")
^= fac
0w89.wgGV4.jAl90.00003.sV4OG.IJjfa.1vYpi.gRxB9.3m6kA.dopig.
RxB93.m6kAd.opigR.xB93m.6kAdo.pigRx.B93m6.kAdop.igRxB.93m6k.
Adopi.gRxBf.vGSfy.m8hQj.T-DiD.7kqvH.vEpA3.3vH-C.in~Tq.l8U0n.
1FVhj.w9E1A.NIF6w.4j9v~.VZ0~B.9flkB.IY90B.-ieSV.Ky8Q~.4~07s.
JcXFC.DtI-1.GGz-1.V-olV.g3wsv.ZCQM1.BJbVj.Vwiv0.uo7Gh.4qsxA.
92ZYU.tJ5uH.yiIzV.FwvJR.UUq6z.cpKIG.Hck9v.qGDm1.PY2rM.itxLB.
fn0Bo.5DO8x.oO7KE.kYh-P.NiKp1.HT88j.Mu3ZK.ciKsU.TnlkV.0Zo77.
12ciy.nY3dM.7nDnY.GVgGh.ZllpO.SFHFb.p1Ae0.uUpXV.eqFvS.pkBRl.
jv0MP.ilRHP.1HwtK.GFptt.2KdpP.RsYqI.wRHEG.j~LZQ.I06qJ.fP0Pp.
77qjo.s0PU0.rGGg6.lgNvc.~CZE~.bSp9j.EGHF~.UqYB6.l4Y~Z.P~GGE.
LwrJs.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h4x93.g0000.
Eq2wR.7jB29
=- ?: &(=(/favicon q.q.pul) ?=([~ ?(%ico %png)] p.q.pul))
%- muff
:- %thou
^- httr
[200 ~[content-type/'image/png'] [~ (taco fac)]]
?: &(=(/robots q.q.pul) ?=([~ %txt] p.q.pul))
%- muff
:- %thou
^- httr
[200 ~[content-type/'text/plain'] [~ (taco rob)]]
(fail 400 "urbit: url {<pul>} does not match a vessel")
:*
^= rob
%- role
:~ 'User-agent: *'
'Disallow: /'
==
::
^= fac
0w89.wgGV4.jAl90.00003.sV4OG.IJjfa.1vYpi.gRxB9.3m6kA.dopig.
RxB93.m6kAd.opigR.xB93m.6kAdo.pigRx.B93m6.kAdop.igRxB.93m6k.
Adopi.gRxBf.vGSfy.m8hQj.T-DiD.7kqvH.vEpA3.3vH-C.in~Tq.l8U0n.
1FVhj.w9E1A.NIF6w.4j9v~.VZ0~B.9flkB.IY90B.-ieSV.Ky8Q~.4~07s.
JcXFC.DtI-1.GGz-1.V-olV.g3wsv.ZCQM1.BJbVj.Vwiv0.uo7Gh.4qsxA.
92ZYU.tJ5uH.yiIzV.FwvJR.UUq6z.cpKIG.Hck9v.qGDm1.PY2rM.itxLB.
fn0Bo.5DO8x.oO7KE.kYh-P.NiKp1.HT88j.Mu3ZK.ciKsU.TnlkV.0Zo77.
12ciy.nY3dM.7nDnY.GVgGh.ZllpO.SFHFb.p1Ae0.uUpXV.eqFvS.pkBRl.
jv0MP.ilRHP.1HwtK.GFptt.2KdpP.RsYqI.wRHEG.j~LZQ.I06qJ.fP0Pp.
77qjo.s0PU0.rGGg6.lgNvc.~CZE~.bSp9j.EGHF~.UqYB6.l4Y~Z.P~GGE.
LwrJs.ZvYV-.U4Wh4.04dws.6HeuZ.2ZF7A.y4MN5.3vsCj.QHzjW.4lflk.
WU6X0.AmMws.vbMfB.3e1s~.aeE7W.0hQPH.ODvMf.cvgzb.Y15Ah.01384.
YwVPT.KzILB.PlaqN.pNlvw.fdQ79.~mPpo.YaHqw.fnWGB.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itqp3.
pkrSC.8bQSM.HLV2J.G7sCj.QtGEi.AkSwI.A4P0J.gJ85j.MuMUY.nkT45.
-rkqv.BFBFU.KGd98.qRs~A.iblOv.mVKWx.Z19cs.AxHc6.UIKJc.NIHW8.
EnOEy.fygRG.29bbR.FBDVL.Ter6T.SBKat.MFBPE.AfuO9.kBHV~.QstE-.
VaYNV.qpfhL.sFHj0.eFphG.U6Hw6.EsVox.7kpks.N6bRk.GMLY~.HWBVj.
Snx6X.0GY2b.GhzmW.udfRF.jTgLC.uPWGL.fIwM6.16Ah4.NFZjz.Ftln7.
KQ-k-.0SO8H.xrqcw.MXZG9.6BZsJ.zULJU.NPDy3.aewMa.3auiA.Ysei3.
YQJGB.PlCAQ.S5YPU.uGEtI.wQrw1.cy8Sd.bFYuX.GGWZS.DSq1Y.O8ELq.
cR6kA.dopig.RxB93.m6kAd.opigR.xB93m.6kAdo.pigRx.B93m6.kAdop.
igRxB.93m6k.Adopi.gRxB9.3m6kA.doSsI.1Tves.7Fb5l.hneus.VDLsZ.
~P3DD.D~CpI.BALPA.rxSTT.fuXa4.gP3Yv.sPKOY.KSMKP.balqk.xjbEH.
idkbq.Elo0N.dHjkM.vEBiq.BC-Rb.IKMiB.JiaoS.x3mLy.Jr6P5.ToiS2.
gAz4y.qNHiI.k7WIl.9EJGb.iJ2Tp.NQ5H5.VpSni.By-OX.TfvYs.plRic.
rpPJD.7xkgk.h9BMw.001EY.XFJDs.CYKpn.1xoTd.HrCAK.tTtT0.6lOon.
tQpCZ.jt5x5.t1A00.01UCO.x20ts.d003n.3g00s.RB8s0.A0002.8p0xY.
20w82.5h9gD.c4000.0l9ny.s0000.0o8p0.0006g.0001i.h4x93.g0000.
Eq2wR.7jB29
==
::
++ huff :: request by ship
|= [our=ship hey=? cip=clip pul=purl moh=moth]

View File

@ -1,4 +1,4 @@
::
!:
:: zuse (3), standard library (tang)
::
|%
@ -553,12 +553,15 @@
10
"\\n"
==
::
++ taco :: atom to octstream
|= tam=@ ^- octs
[(met 3 tam) tam]
::
++ tact :: tape to octstream
|= tep=tape ^- octs
=+ buf=(rap 3 tep)
[(met 3 buf) buf]
(taco (rap 3 tep))
::
++ tell :: wall to octstream
|= wol=wall ^- octs