Merge branch 'release/next-sys' into jb/co-norm

* release/next-sys:
  pill: solid
  zuse: rewrites |base16 for clarity, simplicity, specificity
  zuse: adds basic tests for |base16
  zuse: adds |base16 hex $oct en/decoder
  eyre: prevent binding in reserved namespaces
  pill: solid
  zuse: removes redundant definitions of $mite and $octs
  ames: print failed scrys
This commit is contained in:
Joe Bryan 2020-10-06 13:38:16 -07:00
commit 88d9510111
15 changed files with 107 additions and 18 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7e4edc51f2f314a5236deb4a975d6364cca2164f104b6656446d52ba61ac3e45
size 19166792
oid sha256:2291d9c0febd6ccd7538571ab1e41409f6808b12e5b3d3b0cb3e0fbf8c1bc8aa
size 6319141

View File

@ -9,7 +9,7 @@
|_ ato/@
++ grab |%
++ noun @
++ mime |=({* p/octs:eyre} q.p)
++ mime |=([* p=octs] q.p)
--
++ grow |%
++ mime [/application/x-urb-unknown (as-octs ato)]

View File

@ -16,7 +16,7 @@
++ grab
|%
++ mime
|= [p=mite:eyre q=octs:eyre]
|= (pair mite octs)
=/ wan=wain (to-wain q.q)
?> ?=(^ wan)
%+ murn t.wan

View File

@ -9,7 +9,7 @@
::
++ grab :: convert from
|%
++ mime |=({p/mite:eyre q/octs:eyre} (to-wain q.q))
++ mime |=((pair mite octs) (to-wain q.q))
++ noun wain :: clam from %noun
--
++ grow

View File

@ -6,7 +6,7 @@
::
++ grab :: convert from
|%
++ mime |=([p=mite:eyre q=octs:eyre] (to-wain q.q))
++ mime |=((pair mite octs) (to-wain q.q))
++ noun wain :: clam from %noun
--
++ grow

View File

@ -13,7 +13,7 @@
|%
++ noun pill
++ mime
|= [p=mite:eyre q=octs:eyre]
|= (pair mite octs)
=+ o=(pair ,* ,*) :: ,*)
=+ (,[boot-ova=* kernel-ova=(list o) userspace-ova=(list o)] (cue q.q))
=/ convert

View File

@ -25,7 +25,7 @@
++ grab
|%
++ mime
|= [mite:eyre p=octs:eyre]
|= [mite p=octs]
|^ (rash q.p both-parser)
++ key-val
|* [key=rule val=rule]

View File

@ -23,7 +23,7 @@
++ grab
|%
++ mime
|= [mite:eyre p=octs:eyre]
|= [mite p=octs]
|^ (rash q.p both-parser)
++ key-val
|* [key=rule val=rule]

View File

@ -11,7 +11,7 @@
::
++ grab :: convert from
|%
++ mime |=({p/mite:eyre q/octs:eyre} (to-wain q.q))
++ mime |=((pair mite octs) (to-wain q.q))
++ noun wain :: clam from %noun
--
++ grow

View File

@ -23,7 +23,7 @@
--
++ grab
|%
++ mime |=({p/mite:eyre q/octs:eyre} q.q)
++ mime |=((pair mite octs) q.q)
++ noun @t
++ txt of-wain:format
--

View File

@ -23,7 +23,7 @@
--
++ grab
|%
++ mime |=({p/mite:eyre q/octs:eyre} q.q)
++ mime |=((pair mite octs) q.q)
++ noun @t
++ txt of-wain:format
--

View File

@ -756,6 +756,8 @@
=([%$ %da now] lot)
=(%$ syd)
==
?. for.veb.bug.ames-state ~
~> %slog.0^leaf/"ames: scry-fail {<[why=why lot=lot now=now syd=syd]>}"
~
:: /ax/protocol/version @
:: /ax/peers (map ship ?(%alien %known))

View File

@ -1772,6 +1772,12 @@
|= [=binding =action]
^- [(list move) server-state]
=^ success bindings.state
:: prevent binding in reserved namespaces
::
?: ?| ?=([%'~' *] path.binding) :: eyre
?=([%'~_~' *] path.binding) :: runtime
==
[| bindings.state]
(insert-binding [binding duct action] bindings.state)
:_ state
[duct %give %bound success binding]~

View File

@ -75,10 +75,6 @@
++ life @ud :: ship key revision
++ rift @ud :: ship continuity
++ mime {p/mite q/octs} :: mimetyped data
::
::
:: TODO: Rename to +mime once the current +mime and +mite are gone. The
::
++ octs {p/@ud q/@} :: octet-stream
++ sock {p/ship q/ship} :: outgoing [our his]
::+|
@ -1559,9 +1555,7 @@
$put :: PUT
$trac :: TRACE
== ::
++ mite (list @ta) :: mime type
++ moth {p/meth q/math r/(unit octs)} :: http operation
++ octs {p/@ud q/@t} :: octet-stream
++ oryx @t :: CSRF secret
++ pork {p/(unit @ta) q/(list @t)} :: fully parsed url
:: +prox: proxy notification
@ -6035,6 +6029,7 @@
:::: ++mimes:html :: (2e1) MIME
:: ::::
++ mimes ^?
~% %mimes ..is ~
|%
:: :: ++as-octs:mimes:html
++ as-octs :: atom to octstream
@ -6052,6 +6047,28 @@
?~ myn ~
?: =(~ t.myn) (trip i.myn)
(weld (trip i.myn) `tape`['/' $(myn t.myn)])
::
:: |base16: en/decode arbitrary MSB-first hex strings
::
++ base16
~% %base16 + ~
|%
++ en
~/ %en
|= a=octs ^- cord
(crip ((x-co:co (mul p.a 2)) (end 3 p.a q.a)))
::
++ de
~/ %de
|= a=cord ^- (unit octs)
(rush a rule)
::
++ rule
%+ cook
|= a=(list @) ^- octs
[(add (dvr (lent a) 2)) (repn 4 (flop a))]
(star hit)
--
:: :: ++en-base64:mimes:
++ en-base64 :: encode base64
|= tig/@

View File

@ -0,0 +1,64 @@
:: tests for |mimes:html
::
/+ *test
=, mimes:html
|%
++ test-en-base16
;: weld
%+ expect-eq
!> 'aa'
!> (en:base16 (as-octs 0xaa))
::
%+ expect-eq
!> '1234'
!> (en:base16 (as-octs 0x1234))
::
%+ expect-eq
!> 'f012'
!> (en:base16 (as-octs 0xf012))
::
%+ expect-eq
!> '010b'
!> (en:base16 (as-octs 0x10b))
::
%+ expect-eq
!> '001234'
!> (en:base16 3 0x1234)
::
%+ expect-eq
!> '34'
!> (en:base16 1 0x1234)
==
::
++ test-de-base16
;: weld
%+ expect-eq
!> `[1 0xaa]
!> ^- (unit [@ud @ux])
(de:base16 'aa')
::
%+ expect-eq
!> `[2 0x1234]
!> `(unit [@ud @ux])`(de:base16 '1234')
::
%+ expect-eq
!> `[2 `@`0xf012]
!> ^- (unit [@ud @ux])
(de:base16 'f012')
::
%+ expect-eq
!> lz=`[2 0x10b]
!> ^- (unit [@ud @ux])
(de:base16 '010b')
::
%+ expect-eq
!> nlz=`[2 0x10b]
!> ^- (unit [@ud @ux])
(de:base16 '10b')
::
%+ expect-eq
!> `[3 0x1234]
!> ^- (unit [@ud @ux])
(de:base16 '001234')
==
--