Check in a bunch of web stuff.

This commit is contained in:
C. Guy Yarvin 2014-03-19 18:05:42 -07:00
parent 831cfbf465
commit 3cf9dc3ba2
19 changed files with 504 additions and 216 deletions

View File

@ -14,13 +14,6 @@
ask=[p=@ud q=(map ,@ud ,[p=duct q=hiss])] :: outgoing by number
kes=(map duct ,@ud) :: outgoing by duct
== ::
++ cred :: credential
$: sec=? :: https in url
hut=? :: host defines ship
aut=(map ,@ta (list ,@t)) :: client identities
hot=host :: parsed host
orx=oryx :: CSRF secret
== ::
++ cyst :: client session
$: ced=cred :: credential
cug=(list ,@t) :: unacked cookies
@ -31,7 +24,7 @@
++ loco ,[p=? q=(unit ,@tas) r=path] :: logical construct
++ pest :: request in progress
$| $? %new :: virgin
== ::
== ::
$% [%err p=@ud q=(list tank)] :: error report
[%fin p=love] :: ready to send
[%raw p=hiss] :: wild url
@ -44,23 +37,22 @@
== ::
++ serf :: servant per ship
$: pef=@t :: server prefix
wup=(map logo cyst) :: secure sessions
wup=(map hole cyst) :: secure sessions
:: wez=(map duct root) :: all routes
== ::
-- ::
|%
++ coss :: cookie search
|= [nam=@t mah=math]
^- (unit logo)
^- (unit hole)
=+ ^= cok ^- (list ,@t)
=+ cok=(~(get by mah) 'cookie')
?~(cok ~ u.cok)
|- ^- (unit logo)
?~(cok ~ u.cok)
|- ^- (unit hole)
?~ cok ~
~& [%cookie i.cok]
=+ mar=`(unit (list ,[p=@t q=@t]))`(rush i.cok cock:epur)
?~ mar $(cok t.cok)
|- ^- (unit logo)
|- ^- (unit hole)
?~ u.mar ^$(cok t.cok)
?:(=(nam p.i.u.mar) [~ q.i.u.mar] $(u.mar t.u.mar))
::
@ -80,29 +72,19 @@
%mid [200 ~[content-type/(moon p.luv)] [~ q.luv]]
%ham [200 ~[content-type/'text/html'] [~ (tact (xmlt p.luv ~))]]
%raw p.luv
%wan !!
%zap :+ p.luv
%wan !!
%zap :+ p.luv
~[content-type/'text/plain']
:- ~
%- tell
|- ^- wall
?~ q.luv ~
|- ^- wall
?~ q.luv ~
(weld (~(win re i.q.luv) 0 120) $(q.luv t.q.luv))
==
::
++ lobo :: vase to love
|= [ext=@tas vax=vase]
^- (unit love)
?+ ext ~
%html
?. (~(nest ut [%atom %$]) | p.vax) ~
?> ?=(@ q.vax)
[~ %mid /text/html (met 3 q.vax) q.vax]
==
--
|% :: functions
++ ye :: per event
=| $: $: $: wru=(unit writ) :: event authority
=| $: $: $: wru=(unit writ) :: event authority
tea=wire :: event place
hen=duct :: event floor
fav=card :: event data
@ -110,7 +92,7 @@
$: now=@da :: event date
eny=@ :: unique entropy
sky=$+(* (unit)) :: system namespace
== ::
== ::
mow=(list move) :: pending actions
== ::
bolo :: all vane state
@ -126,7 +108,7 @@
::
++ apex
|- ^+ +
?+ -.fav
?+ -.fav
~|([%ye-bad -.fav] !!)
::
%born +(ged hen) :: register external
@ -200,10 +182,10 @@
=+ gow=(rush i.q.q.pul fed:ag)
^- [(unit ship) (list ,@t)]
?~(gow [~ q.q.pul] [gow t.q.q.pul])
(huff ?^(wiq wiq (doss r.p.pul)) ?=(^ wiq) pul moh)
(huff ?^(wiq wiq (doss r.p.pul)) ?=(@ wiq) pul moh)
::
++ huff :: request by ship
|= [oar=(unit ship) hut=? pul=purl moh=moth]
|= [oar=(unit ship) hey=? pul=purl moh=moth]
^+ +>
=* sec p.p.pul
?~ oar
@ -213,39 +195,149 @@
?^ suf u.suf
=+ sef=*serf
sef(pef (cat 3 gub (rsh 3 1 (scot %p u.oar))))
=+ ^= saw ^- [p=logo q=cyst]
=+ ^= saw ^- [p=hole q=cyst]
=+ lig=(coss pef.sef q.moh)
?^ lig
?^ lig
=+ cyz=(need (~(get by wup.sef) u.lig))
[u.lig cyz(cug ~)]
=+ ses=(rsh 6 1 (scot %p (end 6 1 ney)))
=+ ses=(rsh 3 1 (scot %p (end 6 1 ney)))
:- ses
^- cyst
:* ^- cred
:* sec
hut
:* [sec hey r.p.pul]
~
(rsh 3 1 (scot %p (end 6 1 (shaf %oryx ses))))
~
[%& .0.0.0.0]
~
r.p.pul
?.(sec %$ (rsh 3 1 (scot %p (end 6 1 (shaf %oryx ses)))))
==
::
:_ ~
%^ cat 3
(cat 3 (cat 3 pef.sef '=') ses)
(cat 3 '; HttpOnly' ?.(sec '' '; Secure'))
:: (cat 3 '; HttpOnly' ?.(sec '' '; Secure'))
'; HttpOnly'
::
now
[1 ~]
==
abet:work:(~(into ya [u.oar p.saw] sef q.saw) pul moh)
::
++ lace :: load and execute
|= [pax=path sam=vase]
^- gank
(musk pax (lick pax) sam)
::
++ lank :: probe/load
|= pax=path
^- (unit gank)
=+ dir=(lend pax)
?. (~(has by r.dir) %hoon) ~
=+ pox=(weld pax `path`/hoon)
[~ (much pox (lick pox))]
::
++ lend :: load directory node
|= pax=path
((hard arch) (need (sky %cy pax)))
::
++ liar :: load file as vase
|= pax=path
^- vase
=+ fil=(lick pax)
:_(fil ?^(fil [%cell %noun %noun] [%atom %$]))
::
++ lich :: simple directory
|= pax=path
^- (list ,@tas)
(turn (~(tap by r:(lend pax)) ~) |=([a=@tas b=~] a))
::
++ lick :: load file
|= pax=path
(need (sky %cx path))
(need (sky %cx pax))
::
++ lily :: translation targets
|= [pre=path for=@tas]
^- (list ,@tas)
(lich :(weld pre `path`/tan `path`/[for]))
::
++ lion :: translation graph
|= [too=@tas pre=path fro=(list ,@tas)]
^- (unit (list ,@tas))
=| war=(set ,@tas)
=< -:(apex fro)
|%
++ apex
|= rof=(list ,@tas)
^- [(unit (list ,@tas)) _+>]
?~ rof
[~ +>]
=^ orf +> (apse i.rof)
?^(orf [orf +>.$] $(rof t.rof))
::
++ apse
|= for=@tas
^- [(unit (list ,@tas)) _+>]
?: =(for too) [[~ [too ~]] +>]
?: (~(has in war) for) [~ +>]
=. war (~(put in war) for)
=^ orf +>.$ (apex (lily pre for))
:_ +>.$
?~(orf ~ [~ [for u.orf]])
--
::
++ link :: translate
|= [too=@tas pre=path for=@tas vax=vase]
^- (unit gank)
?: =(for too) [~ %& vax]
=+ wuy=(lion too pre [for ~])
?~ wuy ~
:- ~
?> ?=(^ u.wuy)
?> =(for i.u.wuy)
|- ^- gank
?~ t.u.wuy [%& vax]
=+ mud=(lite i.t.u.wuy pre for vax)
?: ?=(| -.mud) mud
$(t.u.wuy t.t.u.wuy, for i.t.u.wuy, vax p.mud)
::
++ lino :: translate
|= [too=@tas pre=path for=@tas vax=vase]
^- gank
=+ gun=(link too pre for vax)
?^ gun u.gun
[%| [[%leaf "can't make {<too>} from {<for>}"] ~]]
::
++ lite :: step translate
|= [too=@tas pre=path for=@tas vax=vase]
^- gank
(lace :(weld pre `path`/tan `path`/[for] `path`/[too] `path`/hoon) vax)
::
++ loan :: normalize vase
|= [for=@tas pre=path vax=vase]
^- gank
=+ mof=(lank :(weld pre `path`/nor `path`/[for] `path`/hoon))
?~ mof [%& vax]
?: ?=(| -.u.mof) u.mof
=+ pud=(mule |.((~(play ut `type`p.p.u.mof) [%cnzy %$])))
?: ?=(| -.pud) pud
?: (~(nest ut `type`p.pud) | p.vax)
[%& vax]
(mule |.((slam `vase`p.u.mof vax)))
::
++ lobo :: vase to love
|= [for=logo pre=path vax=vase]
^- (each love (list tank))
=+ mud=(lino %mime pre for vax)
?: ?=(| -.mud) mud
[%& %mid (mite -.q.p.mud) (octs +.q.p.mud)]
::
++ loch :: validate vase
|= [for=@tas pre=path vax=vase]
^- gank
=+ wav=(lank :(weld pre `path`/val `path`/[for] `path`/hoon))
?~ wav [%& vax]
?: ?=(| -.u.wav) u.wav
(mule |.((slam `vase`p.u.wav vax)))
::
++ loot :: load extension tree
|= pax=path
@ -263,10 +355,42 @@
all $(ryx t.ryx)
==
::
++ loud :: locations by file
|= [ext=@tas pre=path mid=path]
++ lope :: normalize/validate
|= [for=@tas pre=path vax=vase]
^- gank
=+ mud=(loan for pre vax)
?: ?=(| -.mud) mud
(loch for pre p.mud)
::
++ loth :: direct hard
|= [for=logo pre=path pax=path]
^- gank
(lope for pre (liar pax))
::
++ loti :: translated soft
|= [too=logo for=logo pre=path pax=path sam=vase]
^- gank
=+ mud=(loto for pre pax sam)
?: ?=(| -.mud) mud
(lino too pre for p.mud)
::
++ loto :: direct soft
|= [for=logo pre=path pax=path sam=vase]
=+ mud=(lace pax sam)
?: ?=(| -.mud) mud
(lope for pre p.mud)
::
++ lots :: translated hard
|= [too=logo for=logo pre=path pax=path]
^- gank
=+ mud=(lope for pre (liar pax))
?: ?=(| -.mud) mud
(lino too pre for p.mud)
::
++ loud :: synthesis search
|= [syn=? for=logo pre=path mid=path]
^- (list ,[p=path q=path r=loco])
=| suf=path
=| suf=path
|- ^- (list ,[p=path q=path r=loco])
=+ pax=(weld pre (flop mid))
=+ lot=(loot pax)
@ -279,18 +403,21 @@
=+ mor=$(lot t.lot)
?~ i.lot mor
=+ axp=(weld pax `path`(flop i.lot))
?: ?=([%hoon @ ~] i.lot)
:_(mor [mid suf | ?:(=(ext i.t.i.lot) ~ [~ i.t.i.lot]) axp])
?: &(syn ?=([%hoon @ ~] i.lot))
:_(mor [mid suf | ?:(=(for i.t.i.lot) ~ [~ i.t.i.lot]) axp])
?: ?=([@ ~] i.lot)
:_(mor [mid suf & ?:(=(ext i.i.lot) ~ [~ i.i.lot]) axp])
:_(mor [mid suf & ?:(=(for i.i.lot) ~ [~ i.i.lot]) axp])
mor
::
++ loup :: weak synthesis
|= [ext=@tas toe=tube]
|= [for=logo pre=path mid=path]
^- (unit gank)
=+ pre=`path`[p.toe q.toe r.toe ~]
=+ syn=(weld pre `path`[%syn ~])
=+ luc=(loud ext syn (flop s.toe))
=+ syt=(weld pre `path`[%syn ~])
=+ ^= luc ^- (list ,[p=path q=path r=loco])
=+ luc=(loud | for pre mid)
?. ?=(~ luc) luc
(loud & for syt mid)
?: =(~ luc) ~
=+ ^= waz
|- ^- $: p=(list ,[p=path q=path r=path])
q=(list ,[p=path q=path r=path])
@ -300,28 +427,51 @@
?~ luc [~ ~ ~ ~]
=+ mor=$(luc t.luc)
?- -.r.i.luc
& ?~ q.r.i.luc
& ?~ q.r.i.luc
[[[p.i.luc q.i.luc r.r.i.luc] p.mor] q.mor r.mor s.mor]
[p.mor q.mor [[p.i.luc q.i.luc u.q.r.i.luc r.r.i.luc] r.mor] s.mor]
| ?~ q.r.i.luc
| ?~ q.r.i.luc
[p.mor [[p.i.luc q.i.luc r.r.i.luc] q.mor] r.mor s.mor]
[p.mor q.mor r.mor [[p.i.luc q.i.luc u.q.r.i.luc r.r.i.luc] s.mor]]
==
?^ p.waz :: direct load
=+ fil=(need (sky %cx r.i.p.waz))
[~ %& ^-(vase [?@(fil [%atom %$] %noun) fil])]
?^ q.waz :: indirect load
=+ src=(need (sky %cx r.i.q.waz))
=+ sam=!>([ext pre p.i.q.waz q.i.q.waz])
[~ `gank`(musk r.i.q.waz src sam)]
~
:- ~
?^ p.waz :: direct hard
(loth for pre r.i.p.waz)
?^ q.waz :: direct soft
%- loto
:* for
pre
r.i.q.waz
!>([for pre p.i.q.waz q.i.q.waz])
==
?^ r.waz :: translated hard
(lots for p.r.i.r.waz pre q.r.i.r.waz)
?^ s.waz :: translated soft
%- loti
:* for
p.r.i.s.waz
pre
q.r.i.s.waz
!>([for pre p.i.s.waz q.i.s.waz])
==
!!
::
++ lude :: functional synth
|= [for=logo toe=tube]
^- (unit (each love (list tank)))
=+ [pre mid]=[`path`[p.toe q.toe r.toe ~] `path`(flop s.toe)]
=+ gun=(loup for pre mid)
?~ gun ~
:- ~
?: ?=(| -.u.gun) [%| p.u.gun]
(lobo for pre p.u.gun)
::
++ muff :: return card
|= fav=card
+>(mow :_(mow [wru hen fav]))
::
++ ya :: session engine
=| [[our=ship ses=logo] serf cyst]
=| [[our=ship ses=hole] serf cyst]
=* sef ->-
=* cyz ->+
|%
@ -332,49 +482,42 @@
(~(put by own) our sef(wup (~(put by wup) ses cyz)))
==
::
++ flux :: credential caboose
|= quy=quay
^- coin
:* %many
[%blob ced]
|- ^- (list coin)
?~ quy ~
[[%$ %t p.i.quy] [%$ %t q.i.quy] $(quy t.quy)]
==
::
++ funk :: functional request
|= [imp=? uxt=(unit term) paw=(list ,@t) quy=quay]
|= [imp=? fur=(unit term) paw=(list ,@t) quy=quay]
^- (unit seam)
?~ paw
~& %no-funk
~
?. ((sane %tas) i.paw)
~& %mad-desk
~
=^ cuz t.paw
^- [(unit ,@ta) (list ,@t)]
?: imp
[[~ (scot %da now)] t.paw]
?~ t.paw
[~ ~]
=+ zac=(slay i.t.paw)
?. ?=([~ %$ ?(%ud %da %tas) *] zac) [~ ~]
[[~ i.t.paw] t.t.paw]
?~ cuz
~& %funk-case
~
?. (levy t.paw (sane %ta))
~& %funk-path
~
:+ ~ %fun
:- ?~(uxt %html u.uxt)
^- tube
:* (scot %p our)
i.paw
u.cuz
%+ weld
`path`t.paw
^- path
:_ ~
%~ rent co
:~ %many
[%blob ced]
:- %many
%+ turn quy
|= [a=@t b=@t]
`coin`[%many [%$ %t a] [%$ %t b] ~]
==
==
%+ bind
^- (unit ,[logo tube])
=+ ^= zac ^- (unit ,[p=@ta q=path])
?: imp
[~ (scot %da now) paw]
?~ paw ~
=+ zac=(slay i.paw)
?. ?=([~ %$ ?(%ud %da %tas) *] zac) ~
[~ i.paw t.paw]
?: ?| ?=(~ zac)
?=(~ q.u.zac)
!(levy t.q.u.zac (sane %ta))
== ~
:+ ~ ?~(fur %html u.fur)
^- tube
:* (scot %p our)
i.q.u.zac
p.u.zac
t.q.u.zac
==
|= [for=logo toe=tube]
^- seam
[%fun for toe(s (weld s.toe `path`~[~(rent co (flux quy))]))]
::
++ holy :: structured request
|= [pul=purl moh=moth]
@ -384,14 +527,14 @@
=* paw t.q.q.pul
=+ [one=(end 3 1 nep) two=(cut 3 [1 1] nep) tri=(cut 3 [2 1] nep)]
?. ?& ?- p.moh
%conn |
%delt |
%get =(%g one)
%head =(%g one)
%opts |
%post =(%p one)
%put =(%t one)
%trac |
%conn | :: connect
%delt | :: delete
%get =(%g one) :: get
%head =(%g one) :: head
%opts | :: options
%post =(%p one) :: post
%put =(%t one) :: put
%trac | :: trace
==
?+ two ~
%e & :: stranger
@ -409,7 +552,6 @@
tri
=(3 (met 3 nep))
==
~& [%holy-bad nep]
~
?- tri
?(%f %n) (funk =(%n tri) p.q.pul paw r.pul)
@ -423,7 +565,7 @@
|- ^- [(list ,[p=@ud q=pimp]) _+.^$]
?~ yub [~ +.^$]
=^ sin +.^$ $(yub l.yub)
=^ dex +.^$ $(yub r.yub)
=^ dex +.^$ $(yub r.yub)
=^ top +.^$ (wink q.n.yub)
=+ pot=`(list ,[p=@ud q=pimp])`?~(top ~ [[p.n.yub u.top] ~])
[:(weld pot dex sin) +.^$]
@ -441,15 +583,12 @@
%= pip
pez
^- pest
=+ syt=(loup p.sam.pip q.sam.pip)
=+ syt=(lude p.sam.pip q.sam.pip)
?~ syt
[%err 404 [[%leaf "not found"] ~]]
?- -.u.syt
| [%err 500 p.u.syt]
&
=+ luy=(lobo p.sam.pip p.u.syt)
?~ luy [%err 500 [[%leaf "inappropriate file"] ~]]
[%fin u.luy]
[%err 404 [[%leaf "{<+.sam.pip>} not found"] ~]]
?- -.u.syt
| [%err 500 (flop p.u.syt)]
& [%fin p.u.syt]
==
==
==
@ -479,7 +618,7 @@
$(+ sez)
::
++ into
|= [pul=purl moh=moth]
|= [pul=purl moh=moth]
^+ +>
=+ num=p.rey
%= +>.$
@ -508,8 +647,8 @@
?: ?=(%crud -.fav)
[[[wru [/d hen] %flog fav] ~] ..^$]
^- [p=(list move) q=vane]
=. gub ?.(=(0 gub) gub (cat 3 (scot %p (end 6 1 eny)) '-'))
=^ mos bol
=. gub ?.(=(0 gub) gub (cat 3 (rsh 3 1 (scot %p (end 6 1 eny))) '-'))
=^ mos bol
abet:apex:~(adit ye [[wru tea hen fav] [now eny sky] ~] bol)
[mos ..^$]
::
@ -526,7 +665,7 @@
++ load
|= new=vase
^- vane
?. (~(nest ut -:!>(`bolo`+>-.^$)) | p.new)
?. (~(nest ut -:!>(`bolo`+>-.^$)) | p.new)
~& %eyre-reset
..^$
..^$(+>- (bolo q.new))

View File

@ -1618,6 +1618,12 @@
=> .(a `_(homo a)`a)
=+ b=*(set ,_?>(?=(^ a) i.a))
(~(gas in b) a)
::
++ qu :: make a set
|* a=(list)
=> .(a `_(homo a)`a)
=+ b=*(set ,_?>(?=(^ a) i.a))
(~(gas in b) a)
:::::::::::::::::::::::::::::::::::::::::::::::::::::: ::
:::: chapter 2e, miscellaneous libs ::::
:: ::::::::::::::::::::::::::::::::::::::::::::::::::::::
@ -1839,9 +1845,9 @@
::
++ stet
|* leh=(list ,[?(@ [@ @]) _rule])
|-
?~ leh
~
|-
?~ leh
~
[i=[p=-.i.leh q=+.i.leh] t=$(leh t.leh)]
::
++ stew
@ -2366,7 +2372,7 @@
=('-' c)
==
[c d]
?+ c
?+ c
:- '~'
=+ e=(met 2 c)
|- ^- tape
@ -2526,7 +2532,10 @@
++ til (boss 256 (stun [3 3] low))
++ urs %+ cook
|=(a=tape (rap 3 ^-((list ,@) a)))
(star ;~(pose nud low hep dot sig cab))
(star ;~(pose nud low hep dot sig cab))
++ urt %+ cook
|=(a=tape (rap 3 ^-((list ,@) a)))
(star ;~(pose nud low hep dot sig))
++ voy ;~(pfix bas ;~(pose bas soq bix))
++ vym (bass 256 ;~(plug low (star ;~(pose low nud))))
++ vyn (bass 256 ;~(plug hep vym (easy ~)))
@ -2558,6 +2567,7 @@
++ sym (cook |=(a=(list ,@) (rap 3 a)) ;~(plug vym:ab (star vyn:ab)))
++ tyq (cook |=(a=(list ,@) (rap 3 a)) (plus siq:ab))
++ viz (ape (bass 0x200.0000 ;~(plug pev:ab (star ;~(pfix dog piv:ab)))))
++ vum (bass 32 (plus siv:ab))
++ wiz (ape (bass 0x4000.0000 ;~(plug pew:ab (star ;~(pfix dog piw:ab)))))
--
::
@ -2568,13 +2578,13 @@
++ rend
^- tape
?: ?=(%blob -.lot)
['~' '0' ((w-co 1) (jam p.lot))]
['~' '0' ((v-co 1) (jam p.lot))]
?: ?=(%many -.lot)
:- '.'
|- ^- tape
?~ p.lot
['_' '_' rex]
['_' rend(lot i.p.lot, rex $(p.lot t.p.lot))]
['_' (weld (trip (wack rent(lot i.p.lot))) $(p.lot t.p.lot))]
=+ [yed=(end 3 1 p.p.lot) hay=(cut 3 [1 1] p.p.lot)]
|- ^- tape
?+ yed (z-co q.p.lot)
@ -2683,7 +2693,7 @@
?: =('a' hay)
?: =('s' (cut 3 [2 1] p.p.lot))
(weld (rip 3 q.p.lot) rex)
['~' '.' (weld (rip 3 (wack q.p.lot)) rex)]
['~' '.' (weld (rip 3 q.p.lot) rex)]
['~' '~' (weld (rip 3 (wood q.p.lot)) rex)]
==
--
@ -2705,6 +2715,7 @@
:- '.'
=>(.(rex $(esc t.esc)) ((x-co 4) i.esc))
::
++ v-co |=(min=@ (em-co [32 min] |=([? b=@ c=tape] [~(v ne b) c])))
++ w-co |=(min=@ (em-co [64 min] |=([? b=@ c=tape] [~(w ne b) c])))
++ x-co |=(min=@ (em-co [16 min] |=([? b=@ c=tape] [~(x ne b) c])))
++ y-co |=(dat=@ ((d-co 2) dat))
@ -2752,6 +2763,7 @@
|_ tig=@
++ d (add tig '0')
++ x ?:((gte tig 10) (add tig 87) d)
++ v ?:((gte tig 10) (add tig 87) d)
++ w ?:(=(tig 63) '~' ?:(=(tig 62) '-' ?:((gte tig 36) (add tig 29) x)))
--
::
@ -2825,13 +2837,13 @@
==
::
(stag %p fed:ag)
;~(pfix dot (stag %ta (cook wick urs:ab)))
;~(pfix dot (stag %ta urs:ab))
;~(pfix sig (stag %t (cook woad urs:ab)))
;~(pfix hep (stag %c (cook turf (cook woad urs:ab))))
==
++ nuck
%+ knee *coin |. ~+
%- stew
%- stew
^. stet ^. limo
:~ :- ['a' 'z'] (cook |=(a=@ta [~ %tas a]) sym)
:- ['0' '9'] (stag ~ bisk)
@ -2839,10 +2851,12 @@
:- '.' ;~(pfix dot perd)
:- '~' ;~(pfix sig ;~(pose twid (easy [~ %n 0])))
==
++ nusk
(sear |=(a=@ta (rush (wick a) nuck)) urt:ab)
++ perd
;~ pose
(stag ~ zust)
(stag %many (ifix [cab ;~(plug cab cab)] (more cab nuck)))
(stag %many (ifix [cab ;~(plug cab cab)] (more cab nusk)))
==
++ royl
=+ ^= vox
@ -2869,7 +2883,7 @@
==
++ twid
;~ pose
(cook |=(a=@ [%blob (cue a)]) ;~(pfix (just '0') wiz:ag))
(cook |=(a=@ [%blob (cue a)]) ;~(pfix (just '0') vum:ag))
(stag ~ crub)
==
::
@ -3162,6 +3176,24 @@
?. &(?=(^ gat) ?=(^ +.gat))
[%2 ~]
(mink [[-.gat [sam +>.gat]] -.gat] sky)
::
++ mule :: typed virtual
|* taq=_|.(_*)
=+ mud=(mute taq)
?- -.mud
& [%& p=$:taq]
| [%| p=p.mud]
==
::
++ mute :: untyped virtual
|= taq=_^?(|.(_*))
^- (each ,* (list tank))
=+ ton=(mock [taq 9 2 0 1] |=(* ~))
?- -.ton
%0 [%& p.ton]
%1 [%| (turn p.ton |=(a=* (smyt (path a))))]
%2 [%| p.ton]
==
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: section 2eO, diff (move me) ::
::
@ -4173,7 +4205,7 @@
++ ah
|_ tig=tiki
++ blue
|= gen=twig
|= gen=twig
^- twig
?. &(?=(| -.tig) ?=(~ p.tig)) gen
[%tsgr [~ 3] gen]
@ -4486,13 +4518,13 @@
::
[%ktdt *] [%ktls [%cnhp p.gen q.gen ~] q.gen]
[%kthp *] [%ktls ~(bunt al p.gen) q.gen]
[%sgbr *]
[%sgbr *]
:+ %sggr
:- %mean
=+ fek=~(feck ap p.gen)
?^ fek [%dtzz %tas u.fek]
[%brdt [%cnhp [%cnzy %cain] [%zpgr p.gen] ~]]
q.gen
q.gen
::
[%sgcb *] [%sggr [%mean [%brdt p.gen]] q.gen]
[%sgcn *]
@ -4671,7 +4703,7 @@
[%wtsg *] [%wtcl [%wtts [%axil %null] p.gen] q.gen r.gen]
[%wtzp *] [%wtcl p.gen [%dtzz %f 1] [%dtzz %f 0]]
::
[%wthz *]
[%wthz *]
=+ vaw=~(. ah p.gen)
%- gray:vaw
[%wthp puce:vaw (turn q.gen |=([a=tile b=twig] [a (blue:vaw b)]))]
@ -4680,7 +4712,7 @@
=+ vaw=~(. ah p.gen)
%- gray:vaw
^- twig
:+ %wtls puce:vaw
:+ %wtls puce:vaw
[(blue:vaw q.gen) (turn r.gen |=([a=tile b=twig] [a (blue:vaw b)]))]
::
[%wtsz *]
@ -4699,14 +4731,14 @@
[%wtpt puce:vaw (blue:vaw q.gen) (blue:vaw r.gen)]
::
[%zpcb *] q.gen
[%zpgr *]
[%zpgr *]
[%cnhp [%cnzy %onan] [%zpsm [%bctr [%herb [%cnzy %abel]]] p.gen] ~]
::
[%zpwt *]
?: ?: ?=(@ p.gen)
(lte stub p.gen)
&((lte stub p.p.gen) (gte stub q.p.gen))
q.gen
q.gen
~|([%stub-fail stub p.gen] !!)
::
* gen
@ -4810,7 +4842,7 @@
1 [%face p.got $(got q.got)]
2 ?> |(!vet (nest(sut [%cell %noun %noun]) & sut))
:+ %cell
$(got p.got, sut (peek %both 2))
$(got p.got, sut (peek %both 2))
$(got q.got, sut (peek %both 3))
==
::
@ -4906,8 +4938,8 @@
| (face q.i.peh ^$(peh t.peh, sut p.q.poz))
==
1 ^$(peh t.peh)
2 %+ bull
[p.p.q.poz q.p.q.poz r.p.q.poz ^$(peh t.peh, sut s.p.q.poz)]
2 %+ bull
[p.p.q.poz q.p.q.poz r.p.q.poz ^$(peh t.peh, sut s.p.q.poz)]
q.q.poz
==
=+ [now=(cap p.poz) lat=(mas p.poz)]
@ -5055,8 +5087,8 @@
?. ?=(@ lum)
~
:+ ~
%leaf
?: =(%$ p.q.ham) ~(rend co [~ %ud lum])
%leaf
?: =(%$ p.q.ham) ~(rend co [~ %ud lum])
?: =(%t p.q.ham) ['\'' (weld (rip 3 lum) `tape`['\'' ~])]
?: =(%tas p.q.ham) ['%' ?.(=(0 lum) (rip 3 lum) ['$' ~])]
~(rend co [~ p.q.ham lum])
@ -5384,7 +5416,7 @@
[~ p.u.q.hax %0 (fork p.q.u.q.hax p.q.u.q.yor)]
1 ?> &(?=(1 -.q.u.q.yor) =(p.q.u.q.yor p.q.u.q.hax))
[~ p.u.q.hax %1 p.q.u.q.hax (weld q.q.u.q.hax q.q.u.q.yor)]
2 ?> ?& ?=(2 -.q.u.q.yor)
2 ?> ?& ?=(2 -.q.u.q.yor)
=(p.p.q.u.q.hax p.p.q.u.q.yor)
=(q.p.q.u.q.hax q.p.q.u.q.yor)
=(r.p.q.u.q.hax r.p.q.u.q.yor)
@ -5392,9 +5424,9 @@
:* ~
p.u.q.hax
%2
:* p.p.q.u.q.hax
q.p.q.u.q.hax
r.p.q.u.q.hax
:* p.p.q.u.q.hax
q.p.q.u.q.hax
r.p.q.u.q.hax
(fork s.p.q.u.q.hax s.p.q.u.q.yor)
==
(fork q.q.u.q.hax q.q.u.q.yor)
@ -5752,7 +5784,7 @@
::
[%wtts *]
:- (nice bean)
%- fish(sut (play ~(bunt al p.gen)))
%- fish(sut (play ~(bunt al p.gen)))
(cove q:$(gen [%cnzz q.gen], gol %noun))
::
[%zpcb *]
@ -6103,8 +6135,8 @@
=(p.sut p.ref)
sint
::
[%bull *]
?& dext(sut q.sut)
[%bull *]
?& dext(sut q.sut)
dext(sut s.p.sut, ref (peek(sut ref) %free r.p.sut))
==
[%face *] dext(sut q.sut)
@ -6491,7 +6523,7 @@
==
++ scat
%+ knee *twig |. ~+
%- stew
%- stew
^. stet ^. limo
:~
:- '!'
@ -6688,7 +6720,7 @@
++ noil
|= tol=?
=< ;~ pfix buc
%- stew
%- stew
^. stet ^. limo
:~
['|' (rung bar %reed exqb)]
@ -6716,7 +6748,7 @@
(toad exqc)
==
:- ':'
;~ pfix col
;~ pfix col
%+ cook
|=(a=(list tile) ?~(a !! ?~(t.a i.a [i.a $(a t.a)])))
(toad exqc)
@ -6750,7 +6782,7 @@
^. stet ^. limo
:~ :- '|'
;~ pfix bar
%- stew
%- stew
^. stet ^. limo
:~ ['_' (rune cab %brcb expu)]
['%' (rune cen %brcn expe)]
@ -6766,7 +6798,7 @@
==
:- '%'
;~ pfix cen
%- stew
%- stew
^. stet ^. limo
:~ ['_' (rune cab %cncb exph)]
[':' (rune col %cncl expb)]
@ -6787,7 +6819,7 @@
==
:- ':'
;~ pfix col
%- stew
%- stew
^. stet ^. limo
:~ ['_' (rune cab %clcb expb)]
['~' (rune cen %clcn exps)]
@ -6801,7 +6833,7 @@
==
:- '.'
;~ pfix dot
%- stew
%- stew
^. stet ^. limo
:~ ['+' (rune lus %dtls expa)]
['*' (rune tar %dttr expb)]
@ -6812,7 +6844,7 @@
==
:- '^'
;~ pfix ket
%- stew
%- stew
^. stet ^. limo
:~ ['|' (rune bar %ktbr expa)]
['.' (rune dot %ktdt expb)]
@ -6826,7 +6858,7 @@
==
:- '~'
;~ pfix sig
%- stew
%- stew
^. stet ^. limo
:~ ['|' (rune bar %sgbr expb)]
['$' (rune buc %sgbc expg)]
@ -6844,7 +6876,7 @@
==
:- ';'
;~ pfix sem
%- stew
%- stew
^. stet ^. limo
:~ [':' (rune col %smcl expi)]
['.' (rune dot %smdt expi)]
@ -6854,7 +6886,7 @@
==
:- '='
;~ pfix tis
%- stew
%- stew
^. stet ^. limo
:~ ['|' (rune bar %tsbr expo)]
['.' (rune dot %tsdt expq)]
@ -6870,7 +6902,7 @@
==
:- '?'
;~ pfix wut
%- stew
%- stew
^. stet ^. limo
:~ ['|' (rune bar %wtbr exps)]
[':' (rune col %wtcl expc)]
@ -6889,7 +6921,7 @@
==
:- '!'
;~ pfix zap
%- stew
%- stew
^. stet ^. limo
:~ [':' ;~(pfix col (toad expz))]
[',' (rune com %zpcm expb)]
@ -6962,9 +6994,9 @@
^- tiki
?-(-.b %& [%& [~ a] p.b], %| [%| [~ a] p.b])
=+ ^= wyp
;~ pose
;~ pose
%+ cook gub
;~ plug
;~ plug
sym
;~(pfix tis ;~(pose (stag %& rope) (stag %| wide)))
==
@ -6979,7 +7011,7 @@
;~ pfix
;~(plug ket tis gap)
%+ cook gub
;~ plug
;~ plug
sym
;~(pfix gap ;~(pose (stag %& rope) (stag %| tall)))
==
@ -7040,15 +7072,15 @@
==
==
++ hinh |.
;~ gunk
;~ pose
dem
;~ gunk
;~ pose
dem
(ifix [sel ser] ;~(plug dem ;~(pfix ace dem)))
==
loaf
==
++ bont ;~ (bend)
;~(pfix cen sym)
++ bont ;~ (bend)
;~(pfix cen sym)
;~(pfix dot ;~(pose wide ;~(pfix muck loaf)))
==
++ bony (cook |=(a=(list) (lent a)) (plus tis))
@ -7136,7 +7168,7 @@
++ howl (knee *tile |.(~+(;~(pose (noil &) toil))))
++ toil
%+ knee *tile |. ~+
%- stew
%- stew
^. stet ^. limo
:~
:- '%'
@ -7177,14 +7209,14 @@
==
:- '('
(stag %herb wide)
:- '.'
:- '.'
(stag %herb (stag %cnzz rope))
:- '['
%+ ifix [sel ser]
%+ cook
|= a=(list tile)
?~(a !! ?~(t.a i.a [i.a $(a t.a)]))
(most ace toil)
(most ace toil)
:- '_'
(stag %weed ;~(pfix cab wide))
:- ['0' '9']
@ -7203,7 +7235,7 @@
(stag %leaf (stag %f (cold | bar)))
:- '~'
(stag %leaf (stag %n (cold ~ sig)))
==
==
++ wart
|* zor=_rule
%+ here
@ -7482,7 +7514,7 @@
=+ vil=(vial p.bud) ::
=| eny=@ :: entropy
=| fan=(list ,[p=@tas q=vase]) ::
=| hom=path :: source path
=| hom=path :: source path
=| haz=@uw :: hash
=< |%
++ come |= [@ (list ovum) pone] :: 11
@ -7557,7 +7589,7 @@
~& [%vega-start hap]
=+ src=((hard ,@t) (need (peek now cx/pax)))
=+ saz=(shax src)
=+ gen=(rain hap src)
=+ gen=(rain hap src)
~& %vega-parsed
=+ ken=.*(0 q:(~(mint ut %noun) %noun gen))
=+ ^= nex

View File

@ -1,4 +1,4 @@
::
!:
:: zuse (3), standard library (tang)
::
|%
@ -608,6 +608,7 @@
++ xmlt :: node to tape
|= [mex=manx rez=tape]
^- tape
=> .(mex `mano`?^(mex mex [mex ~]))
?: ?=([%$ [[%$ *] ~]] t.mex)
(xmle v.i.a.t.mex rez)
=+ man=`mane`?@(t.mex t.mex -.t.mex)
@ -1073,7 +1074,7 @@
?: =(2 wid) %king
?: (lte wid 4) %duke
?: (lte wid 8) %earl
?> (lte wid 16) %pawn
?> (lte wid 16) %pawn
::
++ deft :: import url path
|= rax=(list ,@t)
@ -1093,6 +1094,46 @@
:- p.pok
[i.rax q.pok]
::
++ epic !: :: web synthesizer
|* $= yax
$+ $: quy=quay
own=@p
ced=cred
pos=pred
suf=path
but=path
for=@tas
==
*
|= [for=@tas pre=path suf=path but=path]
?> ?=([@ *] but)
=+ dyb=(slay i.but)
?> ?& ?=([~ %many *] dyb)
?=(^ p.u.dyb)
?=([%blob *] i.p.u.dyb)
==
=+ ced=((hard cred) p.i.p.u.dyb)
=+ ^= gut ^- (list ,@t)
%+ turn t.p.u.dyb
|= a=coin ^- @t
?> ?=([%$ %t @] a)
?>(((sane %t) q.p.a) q.p.a)
=+ ^= quy
|- ^- (list ,[p=@t q=@t])
?~ gut ~
?> ?=(^ t.gut)
[[i.gut i.t.gut] $(gut t.t.gut)]
?> ?=([@ @ @ ~] pre)
%- yax
:* quy
(need (slaw %p i.pre))
ced
pre
suf
t.but
for
==
::
++ epur :: url/header parser
|%
++ apat (cook deft ;~(pfix fas (more fas smeg))) :: 2396 abs_path
@ -1136,8 +1177,8 @@
tar lus com sem tis
==
++ ptok ;~ pose :: 2616 token
aln zap hax buc cen pam soq tar lus
hep dot ket cab tec bar sig tis
aln zap hax buc cen pam soq tar lus
hep dot ket cab tec bar sig
==
++ scem :: 2396 scheme
%+ cook cass
@ -1519,38 +1560,37 @@
^- path
[(cat 3 'c' p.kit) (scot %p r.kit) s.kit (scot (dime q.kit)) t.kit]
::
++ muse :: general apply
|= [gen=twig sam=vase]
^- gank
(must !>(+>) gen sam)
::
++ mush :: galactic apply
|= [pax=path sam=vase]
^- (unit gank)
=+ suc=(file (weld pax `path`~[%hoon]))
?~ suc ~
[~ (musk pax u.suc sam)]
::
++ musk :: compiling apply
|= [pax=path src=* sam=vase]
^- gank
?^ src [%| ~[leaf/"musk: {<pax>} is not a source file"]]
++ mojo :: compiling load
|= [pax=path src=*]
^- (each twig (list tank))
?. ?=(@ src)
[%| ~[[leaf/"musk: malformed: {<pax>}"]]]
=+ ^= mud
%- mule |.
((full vest) [1 1] (trip src))
?: ?=(| -.mud) mud
?~ q.p.mud
[%| ~[[leaf/"musk: syntax: {<pax>}:{<q.p.p.mud>}"]]]
(muse `twig`p.u.q.p.mud sam)
:~ %|
leaf/"musk: syntax error: {<pax>}"
leaf/"musk: line {<p.p.p.mud>}, column {<q.p.p.mud>}"
==
[%& p.u.q.p.mud]
::
++ must :: virtual apply
|= [nub=vase gen=twig sam=vase]
++ much :: constructing load
|= [pax=path src=*]
^- gank
=+ mud=(mule |.((slap nub gen)))
=+ moj=(mojo pax src)
?: ?=(| -.moj) moj
(mule |.((slap !>(+>.$) `twig`p.moj)))
::
++ musk :: compiling apply
|= [pax=path src=* sam=vase]
^- gank
=+ mud=(much pax src)
?: ?=(| -.mud) mud
(mule |.((slam p.mud sam)))
::
++ mule :: typed virtual
++ mule :: delete, in h.h
|* taq=_|.(_*)
=+ mud=(mute taq)
?- -.mud
@ -1558,10 +1598,10 @@
| [%| p=p.mud]
==
::
++ mute :: untyped virtual
++ mute !: :: delete, in h.h
|= taq=_^?(|.(_*))
^- (each ,* (list tank))
=+ ton=(mock [taq [0 2]] |=(* ~))
=+ ton=(mock [taq 9 2 0 1] |=(* ~))
?- -.ton
%0 [%& p.ton]
%1 [%| (turn p.ton |=(a=* (smyt (path a))))]
@ -1866,6 +1906,14 @@
kyq=(unit coal) :: app customization
gam=(unit coal) :: app image
== ::
++ cred :: credential
$: hut=hoot :: client host
aut=(map ,@tas (list ,@t)) :: client identities
orx=oryx :: CSRF secret
acc=(unit ,[p=@t q=@t]) :: accept / language
cip=(each ,@if ,@is) :: client IP
cum=(map ,@tas ,*) :: custom dirt
== ::
++ cult (map duct rave) :: subscriptions
++ deed ,[p=@ q=step] :: signature, stage
++ dome :: project state
@ -1966,7 +2014,9 @@
++ heir ,[p=@ud q=mess r=(unit love)] :: status/headers/data
++ hiss ,[p=purl q=moth] :: outbound request
++ hist ,[p=@ud q=(list ,@t)] :: depth texts
++ hole ,@t :: session identity
++ hook path :: request origin
++ hoot ,[p=? q=? r=host] :: secure/mapped/host
++ hart ,[p=? q=(unit ,@ud) r=host] :: http sec/port/host
++ hort ,[p=(unit ,@ud) q=host] :: http port/host
++ hose ,[p=(list tank) q=(unit vase) r=seam s=heir] :: http environment
@ -2013,7 +2063,7 @@
++ lice ,[p=ship q=buck] :: full license
++ life ,@ud :: regime number
++ lint (list rock) :: fragment array
++ logo ,@t :: session identity
++ logo ,@tas :: file type
++ love $% :: http response
[%ham p=manx] :: html node
[%mid p=mite q=octs] :: mime-typed data
@ -2024,7 +2074,8 @@
++ maki ,[p=@ta q=@ta r=@ta s=path]
++ mace (list ,[p=life q=ring]) :: private secrets
++ mane $|(@tas [@tas @tas]) :: XML name/space
++ manx ,[t=marx c=marl] :: XML node
++ mano ,[t=marx c=marl] :: normalized manx
++ manx $|(@tas [t=marx c=marl]) :: XML node
++ marl (list manx) :: XML node list
++ mars ,[t=[n=%$ a=[i=[n=%$ v=tape] t=~]] c=~] :: XML cdata
++ mart (list ,[n=mane v=tape]) :: XML attributes
@ -2096,6 +2147,7 @@
== ::
++ plea ,[p=@ud q=[p=? q=@t]] :: live prompt
++ pork ,[p=(unit ,@ta) q=(list ,@t)] :: fully parsed url
++ pred ,[p=@ta q=@tas r=@ta ~] :: proto-path
++ prod ,[p=prom q=tape r=tape] :: prompt
++ prom ?(%text %pass %none) :: format type
++ purl ,[p=hart q=pork r=quay] :: parsed url

View File

@ -1,2 +1,4 @@
|= *
'<html><body>Goodbye, world (from Hoon)!</body></html> '
!:
|= [for=@tas pre=path mid=path but=path]
%- crip
"<html><body>Goodbye, Galen {<[for pre mid but]>} (from Hoon)!</body></html>"

Binary file not shown.

View File

@ -0,0 +1,33 @@
!:
%- epic
|= [quy=quay own=@p ced=cred pos=pred suf=path but=path for=@tas]
^- manx
:~ %html
:~ %body
~[%h3 +"{(scow %p own)} hails you from afar"]
+"Hi, neighbor!{?:(=(~ quy) "" " You ask: {<quy>}")}?"
%br
+"You addressed the {?:(p.hut.ced "" "in")}secure, "
+"{?:(q.hut.ced "" "un")}bound "
+"{?:(-.r.hut.ced "DNS host {<p.r.hut.ced>}" "IPv4 host {<p.r.hut.ced>}")}."
%br
+"Your CSRF token is '{<orx.ced>}'."
%br
?: ?=(~ acc.ced)
+"You sent no accept headers."
+"You accept {<p.u.acc.ced>}; language {<q.u.acc.ced>}."
%br
?- -.cip.ced
& +"You came from the IPv4 address {<p.cip.ced>}."
| +"You came from the IPv6 address {<p.cip.ced>}."
==
%br
?: =(~ aut.ced)
+"You have no authenticated identities."
+"Authenticated identities: {<aut.ced>}."
%br
+"This synthesis was computed within {<`path`pos>}. "
+"It was found as {<for>}, under {<suf>}"
+"{?:(=(~ but) "." ", in {<but>}.")}"
==
==

View File

@ -0,0 +1,4 @@
!:
|= [for=@tas pre=path mid=path but=path]
%- crip
"<html><body>Goodbye, Galen {<[for pre mid but]>} (from Hoon)!</body></html>"

1
try/syn/web/screw.html Normal file
View File

@ -0,0 +1 @@
It will prefer this.

1
try/syn/web/screw.txt Normal file
View File

@ -0,0 +1 @@
Hi Jaan! This is just text

Binary file not shown.

View File

@ -0,0 +1,6 @@
!:
%- epic
|= [quy=quay own=@p *]
%- crip
"Hi Jaan! Serving query {<quy>} from {<own>}"

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,10 @@
!:
%- epic
|= [quy=quay own=@p *]
^- manx
:~ %html
:~ %body
~[%h3 +"{(scow %p own)} hails you from afar"]
+"Hi, neighbor!{?:(=(~ quy) "" " You ask: {<quy>}")}?"
==
==

2
try/tan/html/mime.hoon Normal file
View File

@ -0,0 +1,2 @@
|= htm=@
[/text/html (met 3 htm) htm]

3
try/tan/htmn/html.hoon Normal file
View File

@ -0,0 +1,3 @@
!:
|= mex=manx
(crip (xmlt mex ~))

3
try/tan/txt/html.hoon Normal file
View File

@ -0,0 +1,3 @@
!:
|= txt=@
(cat 3 '<html><body>' (cat 3 txt '</html></body>'))