%http-server goes from a 2nd level tag to a toplevel tag.

This commit is contained in:
Elliot Glaysher 2019-02-08 16:46:31 -08:00
parent b7c0412224
commit 69670d721c
2 changed files with 48 additions and 48 deletions

View File

@ -290,7 +290,7 @@ _http_req_unlink(u3_hreq* req_u)
static u3_noun
_http_req_to_duct(u3_hreq* req_u)
{
return u3nt(u3_blip, c3__http,
return u3nt(u3_blip, u3i_string("http-server"),
u3nq(u3dc("scot", c3_s2('u','v'), req_u->hon_u->htp_u->sev_l),
u3dc("scot", c3_s2('u','d'), req_u->hon_u->coq_l),
u3dc("scot", c3_s2('u','d'), req_u->seq_l),
@ -304,8 +304,7 @@ _http_req_kill(u3_hreq* req_u)
{
u3_noun pox = _http_req_to_duct(req_u);
u3v_plan(pox, u3nt(u3i_string("http-server"),
u3i_string("cancel-request"),
u3v_plan(pox, u3nc(u3i_string("cancel-request"),
u3_nul));
}
@ -383,12 +382,11 @@ _http_req_dispatch(u3_hreq* req_u, u3_noun req)
u3_noun pox = _http_req_to_duct(req_u);
u3v_plan(pox, u3i_cell(u3i_string("http-server"),
u3nq(u3i_string("request"),
req_u->hon_u->htp_u->sec,
u3nc(c3__ipv4,
u3i_words(1, &req_u->hon_u->ipf_w)),
req)));
u3v_plan(pox, u3nq(u3i_string("request"),
req_u->hon_u->htp_u->sec,
u3nc(c3__ipv4,
u3i_words(1, &req_u->hon_u->ipf_w)),
req));
}
/* _http_hgen_dispose(): dispose response generator and buffers
@ -1518,7 +1516,7 @@ u3_http_ef_bake(void)
u3z(hot);
}
u3_noun pax = u3nq(u3_blip, c3__http, u3k(u3A->sen), u3_nul);
u3_noun pax = u3nq(u3_blip, u3i_string("http-server"), u3k(u3A->sen), u3_nul);
u3v_plan(pax, u3nc(c3__born, ipf));
}
@ -1607,8 +1605,10 @@ u3_http_ef_http_server(c3_l sev_l,
if (c3y == u3r_sing(u3i_string("start"), u3k(u3h(response)))) {
// Separate the %start message into its components.
u3_noun status, headers, data, complete;
if (c3y == u3r_qual(u3t(response), &status, &headers, &data, &complete)) {
u3_noun response_header, data, complete;
u3_noun status, headers;
if (c3y == u3r_trel(u3t(response), &response_header, &data, &complete) &&
c3y == u3r_cell(u3t(response_header), &status, &headers)) {
_http_start_respond(req_u, u3k(status), u3k(headers), u3k(data),
u3k(complete));
} else {
@ -1704,8 +1704,11 @@ _http_serv_start_all(void)
{
c3_assert( u3_none != non );
u3_noun pax = u3nq(u3_blip, c3__http, u3k(u3A->sen), u3_nul);
u3v_plan(pax, u3nq(u3i_string("http-server"), c3__live, non, sec));
u3_noun pax = u3nq(u3_blip,
u3i_string("http-server"),
u3k(u3A->sen),
u3_nul);
u3v_plan(pax, u3nt(c3__live, non, sec));
}
_http_write_ports_file(u3_Host.dir_c);
@ -2573,6 +2576,8 @@ _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));

View File

@ -141,13 +141,6 @@ _reck_kick_http(u3_noun pox,
if ( c3n == u3du(fav) ) {
u3z(pox); u3z(fav); return c3n;
}
else if (c3y == u3r_sing(u3i_string("http-server"), u3k(u3h(fav)))) {
p_fav = u3t(fav);
u3_http_ef_http_server(sev_l, coq_l, seq_l, u3k(p_fav));
u3z(pox); u3z(fav);
return c3y;
}
else switch ( u3h(fav) ) {
default: u3z(pox); u3z(fav); return c3n;
@ -273,43 +266,45 @@ _reck_kick_spec(u3_noun pox, u3_noun fav)
if ( (c3n == u3r_cell(t_pox, &it_pox, &tt_pox)) ) {
u3z(pox); u3z(fav); return c3n;
}
else switch ( it_pox ) {
default: u3z(pox); u3z(fav); return c3n;
else if (c3y == u3r_sing(u3i_string("http-server"), u3k(it_pox))) {
u3_noun pud = tt_pox;
u3_noun p_pud, t_pud, tt_pud, q_pud, r_pud, s_pud;
c3_l sev_l, coq_l, seq_l;
case c3__http: {
u3_noun pud = tt_pox;
u3_noun p_pud, t_pud, tt_pud, q_pud, r_pud, s_pud;
c3_l sev_l, coq_l, seq_l;
if ( (c3n == u3r_cell(pud, &p_pud, &t_pud)) ||
(c3n == _reck_lily(c3__uv, u3k(p_pud), &sev_l)) )
{
u3z(pox); u3z(fav); return c3n;
}
if ( (c3n == u3r_cell(pud, &p_pud, &t_pud)) ||
(c3n == _reck_lily(c3__uv, u3k(p_pud), &sev_l)) )
if ( u3_nul == t_pud ) {
coq_l = seq_l = 0;
}
else {
if ( (c3n == u3r_cell(t_pud, &q_pud, &tt_pud)) ||
(c3n == _reck_lily(c3__ud, u3k(q_pud), &coq_l)) )
{
u3z(pox); u3z(fav); return c3n;
}
if ( u3_nul == t_pud ) {
coq_l = seq_l = 0;
}
else {
if ( (c3n == u3r_cell(t_pud, &q_pud, &tt_pud)) ||
(c3n == _reck_lily(c3__ud, u3k(q_pud), &coq_l)) )
if ( u3_nul == tt_pud ) {
seq_l = 0;
} else {
if ( (c3n == u3r_cell(tt_pud, &r_pud, &s_pud)) ||
(u3_nul != s_pud) ||
(c3n == _reck_lily(c3__ud, u3k(r_pud), &seq_l)) )
{
u3z(pox); u3z(fav); return c3n;
}
if ( u3_nul == tt_pud ) {
seq_l = 0;
} else {
if ( (c3n == u3r_cell(tt_pud, &r_pud, &s_pud)) ||
(u3_nul != s_pud) ||
(c3n == _reck_lily(c3__ud, u3k(r_pud), &seq_l)) )
{
u3z(pox); u3z(fav); return c3n;
}
}
}
return _reck_kick_http(pox, sev_l, coq_l, seq_l, fav);
} break;
}
u3_http_ef_http_server(sev_l, coq_l, seq_l, u3k(fav));
u3z(pox); u3z(fav);
return c3y;
}
else switch ( it_pox ) {
default: u3z(pox); u3z(fav); return c3n;
case c3__behn: {
return _reck_kick_behn(pox, fav);