mirror of
https://github.com/urbit/shrub.git
synced 2025-01-03 01:54:43 +03:00
lull, eyre: remove scry adapters for /~/name endpoint
This commit is contained in:
parent
2874c09e30
commit
d9c9b4150b
@ -1564,9 +1564,8 @@
|
||||
::
|
||||
[%scry ~]
|
||||
:: respond with the @p the requester is authenticated as
|
||||
:: TODO: put this back in when we burn the next kelvin
|
||||
::
|
||||
:: [%name ~]
|
||||
[%name ~]
|
||||
:: respond with the default file not found page
|
||||
::
|
||||
[%four-oh-four ~]
|
||||
|
@ -75,32 +75,6 @@
|
||||
::
|
||||
=server-state
|
||||
==
|
||||
::
|
||||
:: +outstanding-connection-new: intermediate type to enable
|
||||
:: /~/name endpoint without
|
||||
:: breaking type change in lull
|
||||
::
|
||||
+$ outstanding-connection-new
|
||||
$: :: action: the action that had matched
|
||||
::
|
||||
action=action-new
|
||||
:: inbound-request: the original request which caused this connection
|
||||
::
|
||||
=inbound-request
|
||||
:: response-header: set when we get our first %start
|
||||
::
|
||||
response-header=(unit response-header:http)
|
||||
:: bytes-sent: the total bytes sent in response
|
||||
::
|
||||
bytes-sent=@ud
|
||||
==
|
||||
:: +action-new: intermediate type to enable /~/name endpoint
|
||||
:: without breaking type change in lull
|
||||
::
|
||||
+$ action-new
|
||||
$% action
|
||||
[%name ~]
|
||||
==
|
||||
:: +server-state: state relating to open inbound HTTP connections
|
||||
::
|
||||
+$ server-state
|
||||
@ -113,13 +87,13 @@
|
||||
:: TODO: It would be nice if we had a path trie. We could decompose
|
||||
:: the :binding into a (map (unit @t) (trie knot =action)).
|
||||
::
|
||||
bindings=(list [=binding =duct action=action-new])
|
||||
bindings=(list [=binding =duct =action])
|
||||
:: cors-registry: state used and managed by the +cors core
|
||||
::
|
||||
=cors-registry
|
||||
:: connections: open http connections not fully complete
|
||||
::
|
||||
connections=(map duct outstanding-connection-new)
|
||||
connections=(map duct outstanding-connection)
|
||||
:: authentication-state: state managed by the +authentication core
|
||||
::
|
||||
=authentication-state
|
||||
@ -606,7 +580,7 @@
|
||||
::
|
||||
=/ act [%app app=%lens]
|
||||
::
|
||||
=/ connection=outstanding-connection-new
|
||||
=/ connection=outstanding-connection
|
||||
[act [& secure address request] ~ 0]
|
||||
::
|
||||
=. connections.state
|
||||
@ -630,13 +604,13 @@
|
||||
(fall (forwarded-for u.forwards) address)
|
||||
::
|
||||
=/ host (get-header:http 'host' headers)
|
||||
=/ [action=action-new suburl=@t]
|
||||
=/ [=action suburl=@t]
|
||||
(get-action-for-binding host url.request)
|
||||
::
|
||||
=/ authenticated (request-is-logged-in:authentication request)
|
||||
:: record that we started an asynchronous response
|
||||
::
|
||||
=/ connection=outstanding-connection-new
|
||||
=/ connection=outstanding-connection
|
||||
[action [authenticated secure address request] ~ 0]
|
||||
=. connections.state
|
||||
(~(put by connections.state) duct connection)
|
||||
@ -1962,7 +1936,7 @@
|
||||
(session-cookie-string u.session-id &)
|
||||
headers.response-header.http-event
|
||||
::
|
||||
=/ connection=outstanding-connection-new
|
||||
=/ connection=outstanding-connection
|
||||
(~(got by connections.state) duct)
|
||||
:: if the request was a simple cors request from an approved origin
|
||||
:: append the necessary cors headers to the response
|
||||
@ -1998,7 +1972,7 @@
|
||||
::
|
||||
=. connections.state
|
||||
%+ ~(jab by connections.state) duct
|
||||
|= connection=outstanding-connection-new
|
||||
|= connection=outstanding-connection
|
||||
=+ size=?~(data.http-event 0 p.u.data.http-event)
|
||||
connection(bytes-sent (add bytes-sent.connection size))
|
||||
::
|
||||
@ -2051,7 +2025,7 @@
|
||||
:: Adds =binding =action if there is no conflicting bindings.
|
||||
::
|
||||
++ add-binding
|
||||
|= [=binding action=action-new]
|
||||
|= [=binding =action]
|
||||
^- [(list move) server-state]
|
||||
=^ success bindings.state
|
||||
:: prevent binding in reserved namespaces
|
||||
@ -2072,7 +2046,7 @@
|
||||
%_ state
|
||||
bindings
|
||||
%+ skip bindings.state
|
||||
|= [item-binding=^binding item-duct=^duct action=action-new]
|
||||
|= [item-binding=^binding item-duct=^duct =action]
|
||||
^- ?
|
||||
&(=(item-binding binding) =(item-duct duct))
|
||||
==
|
||||
@ -2080,7 +2054,7 @@
|
||||
::
|
||||
++ get-action-for-binding
|
||||
|= [raw-host=(unit @t) url=@t]
|
||||
^- [action=action-new suburl=@t]
|
||||
^- [=action suburl=@t]
|
||||
:: process :raw-host
|
||||
::
|
||||
:: If we are missing a 'Host:' header, if that header is a raw IP
|
||||
@ -2193,8 +2167,8 @@
|
||||
:: +insert-binding: add a new binding, replacing any existing at its path
|
||||
::
|
||||
++ insert-binding
|
||||
|= $: new=[=binding =duct action=action-new]
|
||||
bindings=(list [=binding =duct action=action-new])
|
||||
|= $: new=[=binding =duct =action]
|
||||
bindings=(list [=binding =duct =action])
|
||||
==
|
||||
^+ bindings
|
||||
?~ bindings [new]~
|
||||
@ -2257,7 +2231,7 @@
|
||||
::
|
||||
=. bindings.server-state.ax
|
||||
=- (roll - insert-binding)
|
||||
^- (list [binding ^duct action-new])
|
||||
^- (list [binding ^duct action])
|
||||
:~ [[~ /~/login] duct [%authentication ~]]
|
||||
[[~ /~/logout] duct [%logout ~]]
|
||||
[[~ /~/channel] duct [%channel ~]]
|
||||
@ -2635,31 +2609,6 @@
|
||||
--
|
||||
::
|
||||
++ http-server-gate ..$
|
||||
:: +bindings-old: filter /~/name endpoint from bindings
|
||||
::
|
||||
++ bindings-old
|
||||
|= new=(list [b=binding d=duct a=action-new])
|
||||
=| old=(list [binding duct action])
|
||||
|- ^+ old
|
||||
?~ new old
|
||||
=/ l
|
||||
?: ?=([%name ~] a.i.new)
|
||||
old
|
||||
(snoc old [b.i.new d.i.new a.i.new])
|
||||
$(new t.new, old l)
|
||||
:: +connections-old: filter /~/name endpoint from connections
|
||||
::
|
||||
++ connections-old
|
||||
|= new=(map duct outstanding-connection-new)
|
||||
=| old=(map duct outstanding-connection)
|
||||
=/ l=(list [d=duct o=outstanding-connection-new]) ~(tap by new)
|
||||
|- ^+ old
|
||||
?~ l old
|
||||
=/ x
|
||||
?: ?=([%name ~] -.o.i.l)
|
||||
old
|
||||
(~(put by old) d.i.l o.i.l)
|
||||
$(l t.l, old x)
|
||||
:: +load: migrate old state to new state (called on vane reload)
|
||||
::
|
||||
++ load
|
||||
@ -2714,9 +2663,9 @@
|
||||
=* who p.why
|
||||
?: =(tyl /whey)
|
||||
=/ maz=(list mass)
|
||||
:~ bindings+&+(bindings-old bindings.server-state.ax)
|
||||
:~ bindings+&+bindings.server-state.ax
|
||||
auth+&+authentication-state.server-state.ax
|
||||
connections+&+(connections-old connections.server-state.ax)
|
||||
connections+&+connections.server-state.ax
|
||||
channels+&+channel-state.server-state.ax
|
||||
axle+&+ax
|
||||
==
|
||||
@ -2756,8 +2705,8 @@
|
||||
?. ?=(%$ ren)
|
||||
[~ ~]
|
||||
?+ syd [~ ~]
|
||||
%bindings ``noun+!>((bindings-old bindings.server-state.ax))
|
||||
%connections ``noun+!>((connections-old connections.server-state.ax))
|
||||
%bindings ``noun+!>(bindings.server-state.ax)
|
||||
%connections ``noun+!>(connections.server-state.ax)
|
||||
%authentication-state ``noun+!>(authentication-state.server-state.ax)
|
||||
%channel-state ``noun+!>(channel-state.server-state.ax)
|
||||
::
|
||||
|
Loading…
Reference in New Issue
Block a user