mirror of
https://github.com/urbit/shrub.git
synced 2024-12-21 09:51:36 +03:00
restores tcp proxy (by sending notifications directly over %ames)
This commit is contained in:
parent
c71f41b2b1
commit
d0401f0034
@ -1192,6 +1192,7 @@
|
||||
# define c3__wail c3_s4('w','a','i','l')
|
||||
# define c3__wake c3_s4('w','a','k','e')
|
||||
# define c3__wamp c3_s4('w','a','m','p')
|
||||
# define c3__want c3_s4('w','a','n','t')
|
||||
# define c3__warm c3_s4('w','a','r','m')
|
||||
# define c3__warn c3_s4('w','a','r','n')
|
||||
# define c3__warx c3_s4('w','a','r','x')
|
||||
@ -1213,6 +1214,7 @@
|
||||
# define c3__with c3_s4('w','i','t','h')
|
||||
# define c3__wnut c3_s4('w','n','u','t')
|
||||
# define c3__wood c3_s4('w','o','o','d')
|
||||
# define c3__woot c3_s4('w','o','o','t')
|
||||
# define c3__work c3_s4('w','o','r','k')
|
||||
# define c3__wost c3_s4('w','o','s','t')
|
||||
# define c3__wrap c3_s4('w','r','a','p')
|
||||
|
@ -1058,7 +1058,7 @@
|
||||
/* u3_http_ef_that: send %that effect to http.
|
||||
*/
|
||||
void
|
||||
u3_http_ef_that(u3_noun tat);
|
||||
u3_http_ef_that(u3_noun sip, u3_noun tat);
|
||||
|
||||
/* u3_http_ef_http_server(): dispatch an %http-server effect from %light.
|
||||
*/
|
||||
|
46
vere/http.c
46
vere/http.c
@ -2583,7 +2583,7 @@ _proxy_ward_timer_cb(uv_timer_t* tim_u)
|
||||
static void
|
||||
_proxy_ward_plan(u3_ward* rev_u)
|
||||
{
|
||||
u3_noun non;
|
||||
u3_noun non, cad;
|
||||
|
||||
{
|
||||
c3_w* non_w = c3_malloc(64);
|
||||
@ -2600,17 +2600,19 @@ _proxy_ward_plan(u3_ward* rev_u)
|
||||
rev_u->non_u = uv_buf_init((c3_c*)non_w, len_w);
|
||||
}
|
||||
|
||||
// TODO: all this forwarding stuff doesn't work with %light/http-server.
|
||||
|
||||
// XX confirm duct
|
||||
u3_noun pax = u3nq(u3_blip, c3__http, c3__prox,
|
||||
u3nc(u3k(u3A->sen), u3_nul));
|
||||
{
|
||||
u3_noun who = u3i_chubs(2, rev_u->who_d);
|
||||
u3_noun cha = u3nq(c3__a, c3__give, c3__prox, u3_nul);
|
||||
u3_noun dat = u3nc(c3__that, u3nt(rev_u->por_s,
|
||||
u3k(rev_u->con_u->sec),
|
||||
non));
|
||||
|
||||
u3_noun wis = u3nc(c3__wise, u3nq(u3i_chubs(2, rev_u->who_d),
|
||||
rev_u->por_s,
|
||||
u3k(rev_u->con_u->sec),
|
||||
non));
|
||||
u3v_plan(pax, wis);
|
||||
cad = u3nq(c3__want, who, cha, dat);
|
||||
}
|
||||
|
||||
// XX s/b c3__ames?
|
||||
//
|
||||
u3v_plan(u3nt(u3_blip, c3__newt, u3_nul), cad);
|
||||
}
|
||||
|
||||
/* _proxy_ward_start(): start ward (ship-specific listener).
|
||||
@ -3163,18 +3165,19 @@ _proxy_serv_start(u3_prox* lis_u)
|
||||
/* u3_http_ef_that(): reverse proxy requested connection notification.
|
||||
*/
|
||||
void
|
||||
u3_http_ef_that(u3_noun tat)
|
||||
u3_http_ef_that(u3_noun sip, u3_noun tat)
|
||||
{
|
||||
u3_noun sip, por, sec, non;
|
||||
u3_noun por, sec, non;
|
||||
|
||||
if ( ( c3n == u3r_qual(tat, &sip, &por, &sec, &non) ) ||
|
||||
( c3n == u3ud(sip) ) ||
|
||||
( c3n == u3a_is_cat(por) ) ||
|
||||
!( c3y == sec || c3n == sec ) ||
|
||||
( c3n == u3ud(non) ) ) {
|
||||
uL(fprintf(uH, "http: that: invalid card\n"));
|
||||
}
|
||||
else {
|
||||
u3x_trel(tat, &por, &sec, &non);
|
||||
c3_assert( c3y == u3a_is_cat(por) );
|
||||
c3_assert( c3y == sec || c3n == sec );
|
||||
c3_assert( c3y == u3ud(non) );
|
||||
|
||||
// XX sip s/b validated -- could be *any* ship
|
||||
//
|
||||
|
||||
{
|
||||
u3_http* htp_u;
|
||||
u3_warc* cli_u;
|
||||
|
||||
@ -3207,5 +3210,6 @@ u3_http_ef_that(u3_noun tat)
|
||||
}
|
||||
}
|
||||
|
||||
u3z(sip);
|
||||
u3z(tat);
|
||||
}
|
||||
|
33
vere/reck.c
33
vere/reck.c
@ -152,14 +152,6 @@ _reck_kick_http(u3_noun pox,
|
||||
return c3y;
|
||||
}
|
||||
|
||||
case c3__that: p_fav = u3t(fav);
|
||||
{
|
||||
u3_http_ef_that(u3k(p_fav));
|
||||
|
||||
u3z(pox); u3z(fav);
|
||||
return c3y;
|
||||
}
|
||||
|
||||
case c3__thus: p_fav = u3h(u3t(fav)); q_fav = u3t(u3t(fav));
|
||||
{
|
||||
u3_cttp_ef_thus(u3r_word(0, p_fav), u3k(q_fav));
|
||||
@ -230,6 +222,7 @@ _reck_kick_newt(u3_noun pox, u3_noun fav)
|
||||
{
|
||||
switch ( u3h(fav) ) {
|
||||
default: break;
|
||||
|
||||
case c3__send: {
|
||||
u3_noun lan = u3k(u3h(u3t(fav)));
|
||||
u3_noun pac = u3k(u3t(u3t(fav)));
|
||||
@ -242,7 +235,31 @@ _reck_kick_newt(u3_noun pox, u3_noun fav)
|
||||
u3_ames_ef_turf(u3k(u3t(fav)));
|
||||
u3z(pox); u3z(fav); return c3y;
|
||||
} break;
|
||||
|
||||
case c3__west: {
|
||||
u3_noun who, cha, dat;
|
||||
u3x_trel(u3t(fav), &who, &cha, &dat);
|
||||
|
||||
// XX route by cha path?
|
||||
// s/b //give/prox
|
||||
//
|
||||
switch ( u3h(dat) ) {
|
||||
default: break;
|
||||
|
||||
case c3__that: {
|
||||
u3_http_ef_that(u3k(who), u3k(u3t(dat)));
|
||||
u3z(pox); u3z(fav); return c3y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
case c3__woot: {
|
||||
// XX print tang if nack?
|
||||
//
|
||||
u3z(pox); u3z(fav); return c3y;
|
||||
}
|
||||
}
|
||||
|
||||
u3z(pox); u3z(fav); return c3n;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user