mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-29 12:15:43 +03:00
canonize base64, mime type encoding
This commit is contained in:
parent
7d66d8c3df
commit
c114c5afb7
@ -507,7 +507,7 @@
|
||||
$http
|
||||
?> ?=($mime p.cay)
|
||||
=+ mim=;;(mime q.q.cay)
|
||||
=+ maf=(~(add ja *math:^eyre) %content-type (moon:bytes:eyre p.mim))
|
||||
=+ maf=(~(add ja *math:^eyre) %content-type (en-mite:mimes:html p.mim))
|
||||
(dy-eyre /show q.p.mad [r.p.mad p.p.mad maf ~ q.mim])
|
||||
::
|
||||
$show
|
||||
|
@ -9,8 +9,7 @@
|
||||
/= kid /^ (map knot tree-include)
|
||||
/_ /tree-include/
|
||||
=, format
|
||||
=, bytes:eyre
|
||||
=, base64:eyre
|
||||
=, mimes:html
|
||||
::
|
||||
::::
|
||||
::
|
||||
@ -47,7 +46,7 @@
|
||||
|= a/$%({$t p/cord} {$r p/json} {$j p/json} {$m mime})
|
||||
?- -.a
|
||||
$t [%s p.a]
|
||||
$m (pairs:enjs mite+[%s (moon p.a)] octs+(tape:enjs (sifo q.q.a)) ~)
|
||||
$m (pairs:enjs mite+[%s (en-mite p.a)] octs+(tape:enjs (en-base64 q.q.a)) ~)
|
||||
$r p.a
|
||||
$j p.a
|
||||
==
|
||||
|
@ -8,6 +8,7 @@
|
||||
=, wired
|
||||
=, unity
|
||||
=, format
|
||||
=, mimes:html
|
||||
=, html
|
||||
=> =~
|
||||
|% :: interfaces
|
||||
@ -267,7 +268,7 @@
|
||||
++ resp :: mimed response
|
||||
|= {sas/@uG mit/mite rez/@} ^- httr
|
||||
:: (weld (turn cug |=(a=@t ['set-cookie' a]))
|
||||
[sas ~[content-type+(moon mit)] [~ (taco rez)]]
|
||||
[sas ~[content-type+(en-mite mit)] [~ (taco rez)]]
|
||||
::
|
||||
++ add-links :: x-urbit:// urls
|
||||
|= a/wall ^- marl
|
||||
@ -1070,7 +1071,7 @@
|
||||
=+ ((hard {mit/mite rez/octs}) q.q.cay)
|
||||
=+ dep=(crip "W/{(en-json %s (scot %uv dep))}")
|
||||
=+ bod=?-(men $get `rez, $head ~)
|
||||
=+ hit=[200 ~[etag+dep content-type+(moon mit)] bod]
|
||||
=+ hit=[200 ~[etag+dep content-type+(en-mite mit)] bod]
|
||||
(give-thou (add-cookies cug hit))
|
||||
::
|
||||
++ add-auth
|
||||
|
@ -3445,19 +3445,19 @@
|
||||
=, ^eyre
|
||||
|%
|
||||
:: ::
|
||||
:::: ++mime:html :: (2e1) MIME
|
||||
:::: ++mimes:html :: (2e1) MIME
|
||||
:: ::::
|
||||
++ mime ^?
|
||||
++ mimes ^?
|
||||
|%
|
||||
:: :: ++as-octs:mime:html
|
||||
:: :: ++as-octs:mimes:html
|
||||
++ as-octs :: atom to octstream
|
||||
|= tam/@ ^- octs
|
||||
[(met 3 tam) tam]
|
||||
:: :: ++as-octt:mime:html
|
||||
:: :: ++as-octt:mimes:html
|
||||
++ as-octt :: tape to octstream
|
||||
|= tep/tape ^- octs
|
||||
(as-octs (rap 3 tep))
|
||||
:: :: ++en-mite:mime:html
|
||||
:: :: ++en-mite:mimes:html
|
||||
++ en-mite :: mime type to text
|
||||
|= myn/mite
|
||||
%- crip
|
||||
@ -3465,7 +3465,7 @@
|
||||
?~ myn ~
|
||||
?: =(~ t.myn) (trip i.myn)
|
||||
(weld (trip i.myn) `tape`['/' $(myn t.myn)])
|
||||
:: :: ++en-base64:mime:
|
||||
:: :: ++en-base64:mimes:
|
||||
++ en-base64 :: encode base64
|
||||
|= tig/@
|
||||
^- tape
|
||||
@ -3480,7 +3480,7 @@
|
||||
=+ d=(end 0 6 pad)
|
||||
[(cut 3 [d 1] cha) $(pad (rsh 0 6 pad))]
|
||||
(weld (flop (slag poc sif)) (reap poc '='))
|
||||
:: :: ++de-base64:mime:
|
||||
:: :: ++de-base64:mimes:
|
||||
++ de-base64 :: decode base64
|
||||
=- |=(a/cord (rash a fel))
|
||||
=< fel=(cook |~(a/@ `@t`(swp 3 a)) (bass 64 .))
|
||||
@ -3493,7 +3493,7 @@
|
||||
(cold 62 (just '+'))
|
||||
(cold 63 (just '/'))
|
||||
==
|
||||
-- ::bytes
|
||||
-- ::mimes
|
||||
:: :: ++en-json:html
|
||||
++ en-json :: print json
|
||||
|^ |=(val/json (apex val ""))
|
||||
@ -4570,8 +4570,7 @@
|
||||
++ dill !!
|
||||
++ eyre ^?
|
||||
|%
|
||||
++ base64 [sifo=en-base64 ofis=de-base64]:mime:html
|
||||
++ bytes [moon=en-mite taco=as-octs tact=as-octt]:mime:html
|
||||
++ bytes [taco=as-octs tact=as-octt]:mimes:html
|
||||
++ url
|
||||
=> html ^?
|
||||
|%
|
||||
|
Loading…
Reference in New Issue
Block a user