mirror of
https://github.com/urbit/shrub.git
synced 2024-12-30 15:44:03 +03:00
removes obsolete http effect routing and handlers
This commit is contained in:
parent
d0401f0034
commit
eb0bd01dc4
@ -1068,25 +1068,6 @@
|
||||
c3_l seq_l,
|
||||
u3_noun cad);
|
||||
|
||||
/* u3_http_ef_thou(): send %thou effect to http.
|
||||
*/
|
||||
void
|
||||
u3_http_ef_thou(c3_l sev_l,
|
||||
c3_l coq_l,
|
||||
c3_l seq_l,
|
||||
u3_noun rep);
|
||||
|
||||
/* u3_cttp_ef_thus(): send %thus effect to cttp.
|
||||
*/
|
||||
void
|
||||
u3_cttp_ef_thus(c3_l num_l,
|
||||
u3_noun req);
|
||||
|
||||
/* u3_cttp_ef_http_client(): send %http-client effect to cttp.
|
||||
*/
|
||||
void
|
||||
u3_cttp_ef_http_client(u3_noun fav);
|
||||
|
||||
/* u3_http_ef_bake(): create new http server.
|
||||
*/
|
||||
void
|
||||
@ -1197,11 +1178,10 @@
|
||||
|
||||
/** HTTP client.
|
||||
**/
|
||||
/* u3_cttp_ef_thus(): send %thus effect to cttp.
|
||||
/* u3_cttp_ef_http_client(): send %http-client effect to cttp.
|
||||
*/
|
||||
void
|
||||
u3_cttp_ef_thus(c3_l num_l,
|
||||
u3_noun req);
|
||||
u3_cttp_ef_http_client(u3_noun fav);
|
||||
|
||||
/* u3_cttp_ef_back(): initialization event on restart.
|
||||
*/
|
||||
|
125
vere/cttp.c
125
vere/cttp.c
@ -208,36 +208,6 @@ _cttp_hed_new(u3_atom nam, u3_atom val)
|
||||
return hed_u;
|
||||
}
|
||||
|
||||
// XX vv similar to _http_heds_from_noun
|
||||
/* _cttp_heds_math(): create headers from +math
|
||||
*/
|
||||
static u3_hhed*
|
||||
_cttp_heds_math(u3_noun mah)
|
||||
{
|
||||
u3_noun hed = u3kdi_tap(mah);
|
||||
u3_noun deh = hed;
|
||||
|
||||
u3_hhed* hed_u = 0;
|
||||
|
||||
while ( u3_nul != hed ) {
|
||||
u3_noun nam = u3h(u3h(hed));
|
||||
u3_noun lit = u3t(u3h(hed));
|
||||
|
||||
while ( u3_nul != lit ) {
|
||||
u3_hhed* nex_u = _cttp_hed_new(nam, u3h(lit));
|
||||
nex_u->nex_u = hed_u;
|
||||
|
||||
hed_u = nex_u;
|
||||
lit = u3t(lit);
|
||||
}
|
||||
|
||||
hed = u3t(hed);
|
||||
}
|
||||
|
||||
u3z(deh);
|
||||
return hed_u;
|
||||
}
|
||||
|
||||
// XX deduplicate with _http_heds_from_noun
|
||||
/* _cttp_heds_from_noun(): convert (list (pair @t @t)) to u3_hhed
|
||||
*/
|
||||
@ -559,14 +529,14 @@ _cttp_creq_free(u3_creq* ceq_u)
|
||||
free(ceq_u);
|
||||
}
|
||||
|
||||
/* _cttp_creq_new_from_request(): create a request from an +http-request
|
||||
/* _cttp_creq_new(): create a u3_creq from an +http-request
|
||||
*
|
||||
* If we were rewriting all of this from scratch, this isn't how we'd do it.
|
||||
*
|
||||
* We start with the
|
||||
* We start with the (?? - JB)
|
||||
*/
|
||||
static u3_creq*
|
||||
_cttp_creq_new_from_request(c3_l num_l, u3_noun hes)
|
||||
_cttp_creq_new(c3_l num_l, u3_noun hes)
|
||||
{
|
||||
u3_creq* ceq_u = c3_calloc(sizeof(*ceq_u));
|
||||
|
||||
@ -612,8 +582,6 @@ _cttp_creq_new_from_request(c3_l num_l, u3_noun hes)
|
||||
ceq_u->met_c = u3r_string(method);
|
||||
ceq_u->url_c = _cttp_creq_url(u3k(pul));
|
||||
|
||||
// TODO: mah is a semiparsed header format, which is not what we were passed in.
|
||||
/* ceq_u->hed_u = _cttp_heds_math(u3k(mah)); */
|
||||
ceq_u->hed_u = _cttp_heds_from_noun(u3k(headers));
|
||||
|
||||
if ( u3_nul != body ) {
|
||||
@ -628,57 +596,6 @@ _cttp_creq_new_from_request(c3_l num_l, u3_noun hes)
|
||||
return ceq_u;
|
||||
}
|
||||
|
||||
/* _cttp_creq_new(): create a request from a +hiss noun
|
||||
**
|
||||
** XX obsolete, remove
|
||||
*/
|
||||
static u3_creq*
|
||||
_cttp_creq_new(c3_l num_l, u3_noun hes)
|
||||
{
|
||||
u3_creq* ceq_u = c3_calloc(sizeof(*ceq_u));
|
||||
|
||||
u3_noun pul = u3h(hes); // +purl
|
||||
u3_noun hat = u3h(pul); // +hart
|
||||
u3_noun sec = u3h(hat);
|
||||
u3_noun por = u3h(u3t(hat));
|
||||
u3_noun hot = u3t(u3t(hat)); // +host
|
||||
u3_noun moh = u3t(hes); // +moth
|
||||
u3_noun met = u3h(moh); // +meth
|
||||
u3_noun mah = u3h(u3t(moh)); // +math
|
||||
u3_noun bod = u3t(u3t(moh));
|
||||
|
||||
ceq_u->sat_e = u3_csat_init;
|
||||
ceq_u->num_l = num_l;
|
||||
ceq_u->sec = sec;
|
||||
|
||||
if ( c3y == u3h(hot) ) {
|
||||
ceq_u->hot_c = _cttp_creq_host(u3k(u3t(hot)));
|
||||
} else {
|
||||
ceq_u->ipf_w = u3r_word(0, u3t(hot));
|
||||
ceq_u->ipf_c = _cttp_creq_ip(ceq_u->ipf_w);
|
||||
}
|
||||
|
||||
if ( u3_nul != por ) {
|
||||
ceq_u->por_s = u3t(por);
|
||||
ceq_u->por_c = _cttp_creq_port(ceq_u->por_s);
|
||||
}
|
||||
|
||||
// XX should be capitalized
|
||||
//
|
||||
ceq_u->met_c = u3r_string(met);
|
||||
ceq_u->url_c = _cttp_creq_url(u3k(pul));
|
||||
ceq_u->hed_u = _cttp_heds_math(u3k(mah));
|
||||
|
||||
if ( u3_nul != bod ) {
|
||||
ceq_u->bod_u = _cttp_bod_from_octs(u3k(u3t(bod)));
|
||||
}
|
||||
|
||||
_cttp_creq_link(ceq_u);
|
||||
|
||||
u3z(hes);
|
||||
return ceq_u;
|
||||
}
|
||||
|
||||
/* _cttp_creq_fire_body(): attach body to request buffers.
|
||||
*/
|
||||
static void
|
||||
@ -781,16 +698,6 @@ _cttp_creq_quit(u3_creq* ceq_u)
|
||||
_cttp_creq_free(ceq_u);
|
||||
}
|
||||
|
||||
/* /\* _cttp_httr(): dispatch http response to %eyre */
|
||||
/* *\/ */
|
||||
/* static void */
|
||||
/* _cttp_httr(c3_l num_l, c3_w sas_w, u3_noun mes, u3_noun uct) */
|
||||
/* { */
|
||||
/* u3_noun htr = u3nt(sas_w, mes, uct); */
|
||||
/* u3_noun pox = u3nt(u3_blip, c3__http, u3_nul); */
|
||||
/* u3v_plan(pox, u3nt(c3__they, num_l, htr)); */
|
||||
/* } */
|
||||
|
||||
static void
|
||||
_cttp_http_client_receive(c3_l num_l, c3_w sas_w, u3_noun mes, u3_noun uct)
|
||||
{
|
||||
@ -818,7 +725,6 @@ _cttp_creq_fail(u3_creq* ceq_u, const c3_c* err_c)
|
||||
uL(fprintf(uH, "http: fail (%d, %d): %s\r\n", ceq_u->num_l, cod_w, err_c));
|
||||
|
||||
// XX include err_c as response body?
|
||||
/* _cttp_httr(ceq_u->num_l, cod_w, u3_nul, u3_nul); */
|
||||
_cttp_http_client_receive(ceq_u->num_l, cod_w, u3_nul, u3_nul);
|
||||
_cttp_creq_free(ceq_u);
|
||||
}
|
||||
@ -830,7 +736,6 @@ _cttp_creq_respond(u3_creq* ceq_u)
|
||||
{
|
||||
u3_cres* res_u = ceq_u->res_u;
|
||||
|
||||
/* _cttp_httr(ceq_u->num_l, res_u->sas_w, res_u->hed, */
|
||||
_cttp_http_client_receive(ceq_u->num_l, res_u->sas_w, res_u->hed,
|
||||
( !res_u->bod_u ) ? u3_nul :
|
||||
u3nc(u3_nul, _cttp_bods_to_octs(res_u->bod_u)));
|
||||
@ -1058,28 +963,6 @@ _cttp_init_h2o()
|
||||
return ctx_u;
|
||||
};
|
||||
|
||||
/* u3_cttp_ef_thus(): send %thus effect (outgoing request) to cttp.
|
||||
*/
|
||||
void
|
||||
u3_cttp_ef_thus(c3_l num_l,
|
||||
u3_noun cuq)
|
||||
{
|
||||
u3_creq* ceq_u;
|
||||
|
||||
if ( u3_nul == cuq ) {
|
||||
ceq_u =_cttp_creq_find(num_l);
|
||||
|
||||
if ( ceq_u ) {
|
||||
_cttp_creq_quit(ceq_u);
|
||||
}
|
||||
}
|
||||
else {
|
||||
ceq_u = _cttp_creq_new(num_l, u3k(u3t(cuq)));
|
||||
_cttp_creq_start(ceq_u);
|
||||
}
|
||||
u3z(cuq);
|
||||
}
|
||||
|
||||
/* u3_cttp_ef_http_client(): send an %http-client (outgoing request) to cttp.
|
||||
*/
|
||||
void
|
||||
@ -1091,7 +974,7 @@ u3_cttp_ef_http_client(u3_noun fav)
|
||||
u3_noun p_fav, q_fav;
|
||||
u3x_cell(u3t(fav), &p_fav, &q_fav);
|
||||
|
||||
ceq_u = _cttp_creq_new_from_request(u3r_word(0, p_fav), u3k(q_fav));
|
||||
ceq_u = _cttp_creq_new(u3r_word(0, p_fav), u3k(q_fav));
|
||||
|
||||
if ( ceq_u ) {
|
||||
_cttp_creq_start(ceq_u);
|
||||
|
45
vere/http.c
45
vere/http.c
@ -1522,51 +1522,6 @@ u3_http_ef_bake(void)
|
||||
u3v_plan(pax, u3nc(c3__born, ipf));
|
||||
}
|
||||
|
||||
/* u3_http_ef_thou(): send %thou from %eyre as http response.
|
||||
*/
|
||||
void
|
||||
u3_http_ef_thou(c3_l sev_l,
|
||||
c3_l coq_l,
|
||||
c3_l seq_l,
|
||||
u3_noun rep)
|
||||
{
|
||||
u3_http* htp_u;
|
||||
u3_hcon* hon_u;
|
||||
u3_hreq* req_u;
|
||||
c3_w bug_w = u3C.wag_w & u3o_verbose;
|
||||
|
||||
if ( !(htp_u = _http_serv_find(sev_l)) ) {
|
||||
if ( bug_w ) {
|
||||
uL(fprintf(uH, "http: server not found: %x\r\n", sev_l));
|
||||
}
|
||||
}
|
||||
else if ( !(hon_u = _http_conn_find(htp_u, coq_l)) ) {
|
||||
if ( bug_w ) {
|
||||
uL(fprintf(uH, "http: connection not found: %x/%d\r\n", sev_l, coq_l));
|
||||
}
|
||||
}
|
||||
else if ( !(req_u = _http_req_find(hon_u, seq_l)) ) {
|
||||
if ( bug_w ) {
|
||||
uL(fprintf(uH, "http: request not found: %x/%d/%d\r\n",
|
||||
sev_l, coq_l, seq_l));
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* u3_noun p_rep, q_rep, r_rep; */
|
||||
|
||||
fprintf(stderr, "Old %%thou not used anymore\n");
|
||||
|
||||
/* if ( c3n == u3r_trel(rep, &p_rep, &q_rep, &r_rep) ) { */
|
||||
/* uL(fprintf(uH, "http: strange response\n")); */
|
||||
/* } */
|
||||
/* else { */
|
||||
/* _http_req_respond(req_u, u3k(p_rep), u3k(q_rep), u3k(r_rep)); */
|
||||
/* } */
|
||||
}
|
||||
|
||||
u3z(rep);
|
||||
}
|
||||
|
||||
static u3_hreq*
|
||||
_http_search_req(c3_l sev_l,
|
||||
c3_l coq_l,
|
||||
|
43
vere/reck.c
43
vere/reck.c
@ -127,49 +127,6 @@ _reck_kick_term(u3_noun pox, c3_l tid_l, u3_noun fav)
|
||||
c3_assert(!"not reached"); return 0;
|
||||
}
|
||||
|
||||
/* _reck_kick_http(): apply http effects.
|
||||
*/
|
||||
static u3_noun
|
||||
_reck_kick_http(u3_noun pox,
|
||||
c3_l sev_l,
|
||||
c3_l coq_l,
|
||||
c3_l seq_l,
|
||||
u3_noun fav)
|
||||
{
|
||||
u3_noun p_fav, q_fav;
|
||||
|
||||
if ( c3n == u3du(fav) ) {
|
||||
u3z(pox); u3z(fav); return c3n;
|
||||
}
|
||||
else switch ( u3h(fav) ) {
|
||||
default: u3z(pox); u3z(fav); return c3n;
|
||||
|
||||
case c3__form: p_fav = u3t(fav);
|
||||
{
|
||||
u3_http_ef_form(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));
|
||||
|
||||
u3z(pox); u3z(fav);
|
||||
return c3y;
|
||||
}
|
||||
case c3__thou: p_fav = u3t(fav);
|
||||
{
|
||||
u3_http_ef_thou(sev_l, coq_l, seq_l, u3k(p_fav));
|
||||
|
||||
u3z(pox); u3z(fav);
|
||||
return c3y;
|
||||
} break;
|
||||
}
|
||||
c3_assert(!"not reached"); return c3n;
|
||||
}
|
||||
|
||||
/* _reck_kick_behn(): apply packet network outputs.
|
||||
*/
|
||||
static u3_noun
|
||||
|
Loading…
Reference in New Issue
Block a user