From 80b5c614600f8298612497c66b5ac001c6721cc2 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Tue, 30 Oct 2018 15:02:18 -0400 Subject: [PATCH] Rename FetchReq op to Fetch. --- js/fetch.ts | 10 +++++----- src/msg.fbs | 5 +++-- src/ops.rs | 7 +++---- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/js/fetch.ts b/js/fetch.ts index c0d1dc3e7d..f4c7aaf811 100644 --- a/js/fetch.ts +++ b/js/fetch.ts @@ -199,15 +199,15 @@ export async function fetch( const url = input as string; log("dispatch FETCH_REQ", url); - // Send FetchReq message + // Send Fetch message const builder = flatbuffers.createBuilder(); const url_ = builder.createString(url); - msg.FetchReq.startFetchReq(builder); - msg.FetchReq.addUrl(builder, url_); + msg.Fetch.startFetch(builder); + msg.Fetch.addUrl(builder, url_); const resBase = await sendAsync( builder, - msg.Any.FetchReq, - msg.FetchReq.endFetchReq(builder) + msg.Any.Fetch, + msg.Fetch.endFetch(builder) ); // Decode FetchRes diff --git a/src/msg.fbs b/src/msg.fbs index ba7031621c..f402960a10 100644 --- a/src/msg.fbs +++ b/src/msg.fbs @@ -8,7 +8,7 @@ union Any { Exit, Environ, EnvironRes, - FetchReq, + Fetch, FetchRes, MakeTempDir, MakeTempDirRes, @@ -190,9 +190,10 @@ table EnvPair { value: string; } -table FetchReq { +table Fetch { id: uint; url: string; + // TODO Supply request headers: // header_line: [string]; } diff --git a/src/ops.rs b/src/ops.rs index ce123ccd2a..e93ec5cf72 100644 --- a/src/ops.rs +++ b/src/ops.rs @@ -83,7 +83,7 @@ pub fn dispatch( msg::Any::Dial => op_dial, msg::Any::Environ => op_env, msg::Any::Exit => op_exit, - msg::Any::FetchReq => op_fetch_req, + msg::Any::Fetch => op_fetch, msg::Any::Listen => op_listen, msg::Any::MakeTempDir => op_make_temp_dir, msg::Any::Metrics => op_metrics, @@ -390,18 +390,17 @@ fn op_env( )) } -fn op_fetch_req( +fn op_fetch( state: Arc, base: &msg::Base, data: &'static mut [u8], ) -> Box { assert_eq!(data.len(), 0); - let inner = base.inner_as_fetch_req().unwrap(); + let inner = base.inner_as_fetch().unwrap(); let cmd_id = base.cmd_id(); let id = inner.id(); let url = inner.url().unwrap(); - // FIXME use domain (or use this inside check_net) if let Err(e) = state.check_net(url) { return odd_future(e); }