Skip to main content

euv_cli/update_server/
fn.rs

1use super::*;
2
3/// Validates that a store path component (`project`, `channel`, `track`, `stage_id`) contains no traversal or slashes.
4///
5/// # Arguments
6///
7/// - `&str` - Candidate identifier segment.
8///
9/// # Returns
10///
11/// - `io::Result<()>` - `Ok(())` when safe, or `InvalidInput`.
12pub fn validate_store_identifier(ident: &str) -> io::Result<()> {
13    let all_allowed: bool = ident.bytes().all(|blue_val: u8| {
14        blue_val.is_ascii_alphanumeric()
15            || blue_val == ASCII_HYPHEN
16            || blue_val == ASCII_UNDERSCORE
17            || blue_val == ASCII_DOT
18    });
19    if ident.is_empty()
20        || ident == "."
21        || ident == ".."
22        || ident.contains("..")
23        || ident.contains('/')
24        || ident.contains('\\')
25        || !all_allowed
26    {
27        return Err(Error::new(
28            ErrorKind::InvalidInput,
29            format!("{ERR_INVALID_STORE_IDENT}: `{ident}`"),
30        ));
31    }
32    Ok(())
33}
34
35/// Resolves the external proxy-aware base URL from `--proxy-base` or incoming reverse-proxy headers (`X-Forwarded-Proto`, `X-Forwarded-Host`, `X-Forwarded-Prefix`).
36///
37/// # Arguments
38///
39/// - `&str` - Explicitly configured `--proxy-base` value (may be empty).
40/// - `Option<&str>` - Optional `X-Forwarded-Proto` header value.
41/// - `Option<&str>` - Optional `X-Forwarded-Host` header value.
42/// - `Option<&str>` - Optional `X-Forwarded-Prefix` header value.
43///
44/// # Returns
45///
46/// - `Option<String>` - Normalized proxy base URL or prefix without trailing slash, if any.
47#[must_use]
48pub fn resolve_proxy_base_url(
49    configured_proxy_base: &str,
50    fwd_proto: Option<&str>,
51    fwd_host: Option<&str>,
52    fwd_prefix: Option<&str>,
53) -> Option<String> {
54    let explicit: &str = configured_proxy_base.trim().trim_end_matches('/');
55    if !explicit.is_empty() {
56        return Some(explicit.to_string());
57    }
58    let clean_prefix: String = fwd_prefix
59        .map(|text_value: &str| {
60            let trimmed: &str = text_value.trim().trim_end_matches('/');
61            if trimmed.is_empty() {
62                String::new()
63            } else if trimmed.starts_with('/') {
64                trimmed.to_string()
65            } else {
66                format!("/{trimmed}")
67            }
68        })
69        .unwrap_or_default();
70    if let Some(host_raw) = fwd_host {
71        let host: &str = host_raw
72            .split(',')
73            .next()
74            .unwrap_or("")
75            .trim()
76            .trim_end_matches('/');
77        if !host.is_empty() {
78            let proto: &str = fwd_proto
79                .and_then(|label_str: &str| label_str.split(',').next())
80                .map(str::trim)
81                .filter(|point_val: &&str| !point_val.is_empty())
82                .unwrap_or("http");
83            return Some(format!("{proto}://{host}{clean_prefix}"));
84        }
85    }
86    if !clean_prefix.is_empty() {
87        return Some(clean_prefix);
88    }
89    None
90}
91
92/// Applies permissive CORS response headers for browser and cross-origin proxy clients.
93///
94/// # Arguments
95///
96/// - `&mut Context` - Active Hyperlane request context.
97#[cfg(feature = "update-server")]
98pub(crate) fn apply_update_cors_headers(ctx: &mut Context) {
99    let _: &mut Response = ctx
100        .get_mut_response()
101        .set_header(UPDATE_HDR_CORS_ORIGIN, UPDATE_VAL_CORS_ANY)
102        .set_header(UPDATE_HDR_CORS_METHODS, UPDATE_VAL_CORS_METHODS)
103        .set_header(UPDATE_HDR_CORS_HEADERS, UPDATE_VAL_CORS_HEADERS)
104        .set_header(UPDATE_HDR_CORS_EXPOSE, UPDATE_VAL_CORS_EXPOSE);
105}
106
107/// Formats the Hyperlane SSE topic name isolating events per `(project, channel)`.
108///
109/// # Arguments
110///
111/// - `&str` - Logical project identifier.
112/// - `&str` - Release channel name.
113///
114/// # Returns
115///
116/// - `String` - Canonical SSE topic key.
117#[must_use]
118pub fn sse_topic_for_channel(project: &str, channel: &str) -> String {
119    format!("{project}:{channel}")
120}
121
122/// Parses an HTTP `Range: bytes=start-[end]` header against a blob of `total_len` bytes.
123///
124/// # Arguments
125///
126/// - `Option<&str>` - Raw `Range` header value, if present.
127/// - `usize` - Total immutable blob length in bytes.
128///
129/// # Returns
130///
131/// - `ByteRangeSpec` - Full, inclusive byte slice, or invalid range indicator.
132#[must_use]
133pub fn parse_http_byte_range(header: Option<&str>, total_len: usize) -> ByteRangeSpec {
134    let Some(raw) = header else {
135        return ByteRangeSpec::Full;
136    };
137    let trimmed: &str = raw.trim();
138    let Some(spec) = trimmed.strip_prefix(RANGE_BYTES_PREFIX) else {
139        return ByteRangeSpec::Invalid;
140    };
141    if spec.contains(',') || total_len == 0 {
142        return ByteRangeSpec::Invalid;
143    }
144    let Some((start_str, end_str)) = spec.split_once('-') else {
145        return ByteRangeSpec::Invalid;
146    };
147    let start_trimmed: &str = start_str.trim();
148    let end_trimmed: &str = end_str.trim();
149    if start_trimmed.is_empty() {
150        let Ok(suffix_len) = end_trimmed.parse::<usize>() else {
151            return ByteRangeSpec::Invalid;
152        };
153        if suffix_len == 0 {
154            return ByteRangeSpec::Invalid;
155        }
156        let start: usize = total_len.saturating_sub(suffix_len);
157        return ByteRangeSpec::Slice {
158            start,
159            end: total_len - 1,
160        };
161    }
162    let Ok(start) = start_trimmed.parse::<usize>() else {
163        return ByteRangeSpec::Invalid;
164    };
165    if start >= total_len {
166        return ByteRangeSpec::Invalid;
167    }
168    let end: usize = if end_trimmed.is_empty() {
169        total_len - 1
170    } else {
171        let Ok(parsed_end) = end_trimmed.parse::<usize>() else {
172            return ByteRangeSpec::Invalid;
173        };
174        parsed_end.min(total_len - 1)
175    };
176    if end < start {
177        return ByteRangeSpec::Invalid;
178    }
179    ByteRangeSpec::Slice { start, end }
180}
181
182/// Atomically writes `bytes` to `target` using a sibling temp file, `sync_all()`, atomic rename, and parent directory sync.
183///
184/// # Arguments
185///
186/// - `&Path` - Destination file path.
187/// - `&[u8]` - Complete file bytes to persist crash-safely.
188///
189/// # Returns
190///
191/// - `io::Result<()>` - Crash-safe persistence outcome.
192pub(crate) fn atomic_write_synced(target: &Path, bytes: &[u8]) -> io::Result<()> {
193    if let Some(parent) = target.parent() {
194        fs::create_dir_all(parent)?;
195    }
196    let seq: u64 = ATOMIC_TMP_SEQ.fetch_add(1, Ordering::Relaxed);
197    let pid: u32 = process::id();
198    let file_name: String = target
199        .file_name()
200        .map(|item_count: &OsStr| item_count.to_string_lossy().into_owned())
201        .unwrap_or_else(|| "tmp".to_string());
202    let tmp_path: PathBuf = target.with_file_name(format!(".{file_name}.tmp.{pid}.{seq}"));
203    {
204        let mut file: File = OpenOptions::new()
205            .write(true)
206            .create_new(true)
207            .open(&tmp_path)?;
208        file.write_all(bytes)?;
209        file.sync_all()?;
210    }
211    fs::rename(&tmp_path, target)?;
212    #[cfg(unix)]
213    if let Some(parent) = target.parent()
214        && let Ok(dir) = File::open(parent)
215    {
216        let _: io::Result<()> = dir.sync_all();
217    }
218    Ok(())
219}
220
221/// Returns the current UNIX epoch timestamp in seconds.
222///
223/// # Returns
224///
225/// - `u64` - Whole seconds elapsed since `UNIX_EPOCH`.
226#[must_use]
227pub(crate) fn current_unix_secs() -> u64 {
228    SystemTime::now()
229        .duration_since(UNIX_EPOCH)
230        .map(|delta_val: Duration| delta_val.as_secs())
231        .unwrap_or(0)
232}
233
234/// Parses a delivery mode query token into `DeliveryChannelMode`.
235///
236/// # Arguments
237///
238/// - `Option<&str>` - Optional query string value.
239///
240/// # Returns
241///
242/// - `DeliveryChannelMode` - Resolved channel delivery mode (defaults to `WasmComponent`).
243#[cfg(feature = "update-server")]
244#[must_use]
245pub(crate) fn parse_delivery_mode_token(raw: Option<&str>) -> DeliveryChannelMode {
246    match raw.map(str::trim) {
247        Some(tok) if tok.eq_ignore_ascii_case(MODE_TOKEN_DATA) => {
248            DeliveryChannelMode::DeclarativeData
249        }
250        _ => DeliveryChannelMode::WasmComponent,
251    }
252}
253
254/// Registers the three read-only dynamic update routes onto an embeddable Hyperlane `Server`.
255///
256/// # Arguments
257///
258/// - `&mut Server` - Hyperlane server instance receiving the routes.
259/// - `Arc<UpdateServerState>` - Shared update store and SSE pub/sub hub state.
260#[cfg(feature = "update-server")]
261pub fn register_update_routes(server: &mut Server, state: Arc<UpdateServerState>) {
262    let slot: &RwLock<Option<Arc<UpdateServerState>>> =
263        DEFAULT_UPDATE_SERVER_STATE.get_or_init(|| RwLock::new(None));
264    if let Ok(mut guard) = slot.write() {
265        *guard = Some(state);
266    }
267    let _: &mut Server = server
268        .route::<ManifestRouteHook>(UPDATE_ROUTE_MANIFEST)
269        .route::<BlobRouteHook>(UPDATE_ROUTE_BLOB)
270        .route::<EventsRouteHook>(UPDATE_ROUTE_EVENTS);
271}
272
273/// Starts a live read-only Hyperlane HTTP + SSE update server with a background pointer watcher.
274///
275/// # Arguments
276///
277/// - `UpdateServerConfig` - Store root, bind address, SSE heartbeat/replay, and poll settings.
278///
279/// # Returns
280///
281/// - `io::Result<UpdateServerHandle>` - Running server handle or startup I/O error.
282#[cfg(feature = "update-server")]
283pub fn start_update_server(config: UpdateServerConfig) -> io::Result<UpdateServerHandle> {
284    let mut store: UpdateStore = UpdateStore::new(config.get_store_root().clone());
285    store.set_max_artifact_bytes(config.get_max_artifact_bytes());
286    store.init_layout()?;
287    let sse_config: SseConfig = SseConfig::default()
288        .with_heartbeat_ms(config.get_heartbeat_ms())
289        .with_retry_ms(config.get_retry_ms())
290        .with_replay_capacity(config.get_replay_capacity());
291    let state: Arc<UpdateServerState> = Arc::new(
292        UpdateServerState::new(store, sse_config).with_proxy_base(config.get_proxy_base().clone()),
293    );
294    state.sync_store_events_to_sse();
295    let runtime_ref: runtime::Runtime = runtime::Builder::new_multi_thread()
296        .worker_threads(2)
297        .enable_all()
298        .build()?;
299    let max_attempts: usize = if config.get_port() == 0 { 8 } else { 1 };
300    let mut last_err: Option<Error> = None;
301    let mut bound_pair: Option<(SocketAddr, ServerControlHook)> = None;
302    for _ in 0..max_attempts {
303        let candidate_addr: SocketAddr = resolve_bind_addr(config.get_host(), config.get_port())?;
304        register_server_state_for_addr(candidate_addr, Arc::clone(&state));
305        let mut server_cfg: ServerConfig = ServerConfig::default();
306        server_cfg.set_address(candidate_addr.to_string());
307        let mut server: Server = Server::from(server_cfg);
308        register_update_routes(&mut server, Arc::clone(&state));
309        match runtime_ref.block_on(async move { server.run().await }) {
310            Ok(control) => {
311                bound_pair = Some((candidate_addr, control));
312                break;
313            }
314            Err(err) => {
315                unregister_server_state_for_addr(candidate_addr);
316                last_err = Some(Error::other(err.to_string()));
317            }
318        }
319    }
320    let (resolved_addr, control): (SocketAddr, ServerControlHook) = match bound_pair {
321        Some(pair) => pair,
322        None => {
323            return Err(last_err.unwrap_or_else(|| Error::from(ErrorKind::AddrInUse)));
324        }
325    };
326    let watcher_state: Arc<UpdateServerState> = Arc::clone(&state);
327    let poll_ms: u64 = config.get_watch_poll_ms().max(20);
328    let _: task::JoinHandle<()> = runtime_ref.spawn(async move {
329        run_pointer_watcher_task(watcher_state, poll_ms).await;
330    });
331    Ok(UpdateServerHandle {
332        address: resolved_addr,
333        state,
334        control: Some(control),
335        runtime: Some(runtime_ref),
336    })
337}
338
339/// Runs the Hyperlane HTTP + SSE update server in blocking CLI mode (or exits immediately when `--once` is set).
340///
341/// # Arguments
342///
343/// - `UpdateServerConfig` - Server configuration.
344///
345/// # Returns
346///
347/// - `io::Result<UpdateServerReport>` - Machine-readable server startup report.
348#[cfg(feature = "update-server")]
349pub fn run_update_server_blocking(config: UpdateServerConfig) -> io::Result<UpdateServerReport> {
350    let once: bool = config.get_once();
351    let mut handle: UpdateServerHandle = start_update_server(config)?;
352    let report: UpdateServerReport = handle.report(once);
353    if once {
354        handle.shutdown();
355        return Ok(report);
356    }
357    eprintln!(
358        "[euv-update] serving store={} url={} manifest={} blobs={} events={}",
359        report.get_store_root(),
360        report.get_url(),
361        report.get_manifest_route(),
362        report.get_blob_route(),
363        report.get_events_route()
364    );
365    while handle.is_running() {
366        thread::sleep(Duration::from_millis(250));
367    }
368    handle.shutdown();
369    Ok(report)
370}
371
372/// Returns a clear feature error when `euv update serve` is invoked without the `update-server` feature enabled.
373///
374/// # Arguments
375///
376/// - `UpdateServerConfig` - Unused server configuration.
377///
378/// # Returns
379///
380/// - `io::Result<UpdateServerReport>` - Always returns `ErrorKind::Unsupported`.
381#[cfg(not(feature = "update-server"))]
382pub fn run_update_server_blocking(_config: UpdateServerConfig) -> io::Result<UpdateServerReport> {
383    Err(Error::new(
384        ErrorKind::Unsupported,
385        ERR_UPDATE_SERVER_FEATURE_DISABLED,
386    ))
387}
388
389/// Resolves a concrete `SocketAddr`, allocating an ephemeral port when `port == 0`.
390///
391/// # Arguments
392///
393/// - `&str` - Host address string.
394/// - `u16` - Requested port (`0` allocates an ephemeral port).
395///
396/// # Returns
397///
398/// - `io::Result<SocketAddr>` - Resolved concrete socket address.
399#[cfg(feature = "update-server")]
400fn resolve_bind_addr(host: &str, port: u16) -> io::Result<SocketAddr> {
401    if port != 0 {
402        let raw: String = format!("{host}:{port}");
403        return raw
404            .parse::<SocketAddr>()
405            .map_err(|err: AddrParseError| Error::new(ErrorKind::InvalidInput, err.to_string()));
406    }
407    let probe: TcpListener = TcpListener::bind(format!("{host}:0"))?;
408    let addr: SocketAddr = probe.local_addr()?;
409    drop(probe);
410    Ok(addr)
411}
412
413/// Registers `state` for `addr` in the per-listener server registry.
414///
415/// # Arguments
416///
417/// - `SocketAddr` - Bound listener address.
418/// - `Arc<UpdateServerState>` - Shared server state.
419#[cfg(feature = "update-server")]
420pub(crate) fn register_server_state_for_addr(addr: SocketAddr, state: Arc<UpdateServerState>) {
421    let map: &RwLock<HashMap<SocketAddr, Arc<UpdateServerState>>> =
422        UPDATE_SERVER_REGISTRY.get_or_init(|| RwLock::new(HashMap::new()));
423    if let Ok(mut guard) = map.write() {
424        let _: Option<Arc<UpdateServerState>> = guard.insert(addr, state);
425    }
426}
427
428/// Removes `addr` from the per-listener server registry upon server shutdown.
429///
430/// # Arguments
431///
432/// - `SocketAddr` - Listener address being closed.
433#[cfg(feature = "update-server")]
434pub(crate) fn unregister_server_state_for_addr(addr: SocketAddr) {
435    if let Some(map) = UPDATE_SERVER_REGISTRY.get()
436        && let Ok(mut guard) = map.write()
437    {
438        let _: Option<Arc<UpdateServerState>> = guard.remove(&addr);
439    }
440}
441
442/// Resolves the `UpdateServerState` associated with the incoming Hyperlane `Stream`.
443///
444/// # Arguments
445///
446/// - `&Stream` - Active Hyperlane client stream.
447///
448/// # Returns
449///
450/// - `Option<Arc<UpdateServerState>>` - Matching server state if registered.
451#[cfg(feature = "update-server")]
452pub(crate) fn resolve_server_state(stream: &Stream) -> Option<Arc<UpdateServerState>> {
453    if let Ok(local_addr) = stream.get_local_addr()
454        && let Some(map) = UPDATE_SERVER_REGISTRY.get()
455        && let Ok(guard) = map.read()
456        && let Some(found) = guard.get(&local_addr)
457    {
458        return Some(Arc::clone(found));
459    }
460    DEFAULT_UPDATE_SERVER_STATE
461        .get()
462        .and_then(|lock: &RwLock<Option<Arc<UpdateServerState>>>| lock.read().ok())
463        .and_then(|guard: RwLockReadGuard<'_, Option<Arc<UpdateServerState>>>| guard.clone())
464}
465
466/// Background task polling the filesystem store pointers and event log so separate CLI `publish`/`rollback` processes trigger SSE automatically.
467///
468/// # Arguments
469///
470/// - `Arc<UpdateServerState>` - Shared server state.
471/// - `u64` - Polling cadence in milliseconds.
472#[cfg(feature = "update-server")]
473async fn run_pointer_watcher_task(state: Arc<UpdateServerState>, poll_ms: u64) {
474    let mut ticker: Interval = interval(Duration::from_millis(poll_ms));
475    while state.is_running() {
476        let _: Instant = ticker.tick().await;
477        if !state.is_running() {
478            break;
479        }
480        state.sync_store_events_to_sse();
481    }
482}
483
484/// Streams disk-backed `Last-Event-ID` replay frames followed by live `SseSubscription` fan-out and heartbeats.
485///
486/// # Arguments
487///
488/// - `&mut Stream` - Active Hyperlane client stream.
489/// - `&mut Context` - Active Hyperlane request context.
490/// - `Vec<StoredReleaseEvent>` - Persisted events strictly newer than the client's `Last-Event-ID`.
491/// - `SseSubscription` - Live Hyperlane SSE subscription attached before replay read.
492/// - `&SseConfig` - Heartbeat and reconnect configuration.
493///
494/// # Returns
495///
496/// - `Result<(), SseError>` - Completes cleanly when the stream closes or disconnects.
497#[cfg(feature = "update-server")]
498pub(crate) async fn serve_release_sse_stream(
499    stream: &mut Stream,
500    ctx: &mut Context,
501    replay_events: Vec<StoredReleaseEvent>,
502    mut subscription: SseSubscription,
503    config: &SseConfig,
504) -> Result<(), SseError> {
505    SseStream::prepare(ctx);
506    apply_update_cors_headers(ctx);
507    let _: &mut Response = ctx
508        .get_mut_response()
509        .set_header(CACHE_CONTROL, UPDATE_SSE_CACHE_CONTROL)
510        .set_header(UPDATE_HDR_ACCEL_BUFFERING, UPDATE_VAL_NO_BUFFER);
511    let head: ResponseData = ctx.get_mut_response().build_head();
512    stream
513        .try_send(&head)
514        .await
515        .map_err(|err: ResponseError| SseError::Transport(err.to_string()))?;
516    let mut scratch: Vec<u8> = Vec::with_capacity(256);
517    if config.get_retry_ms() > 0 {
518        let hint: SseEvent =
519            SseEvent::comment_only(UPDATE_SSE_CONNECTED_COMMENT).with_retry(config.get_retry_ms());
520        SseStream::send_event_buffered(stream, &hint, &mut scratch).await?;
521    }
522    let mut last_sent_seq: u64 = 0;
523    for rec in replay_events.into_iter() {
524        if let Ok(json) = to_string(rec.get_event()) {
525            let ui_event: SseEvent = SseEvent::new(json)
526                .with_id(rec.get_event_id().to_string())
527                .with_event(SSE_EVENT_RELEASE_ACTIVATED);
528            SseStream::send_event_buffered(stream, &ui_event, &mut scratch).await?;
529            if rec.get_event_id() > last_sent_seq {
530                last_sent_seq = rec.get_event_id();
531            }
532        }
533    }
534    let heartbeat_ms: u64 = config.get_heartbeat_ms();
535    if heartbeat_ms == 0 {
536        loop {
537            match subscription.recv().await {
538                Ok(event) => {
539                    let ev_seq: u64 = event
540                        .get_id()
541                        .as_deref()
542                        .and_then(|text_value: &str| text_value.parse::<u64>().ok())
543                        .unwrap_or(u64::MAX);
544                    if ev_seq <= last_sent_seq {
545                        continue;
546                    }
547                    SseStream::send_event_buffered(stream, &event, &mut scratch).await?;
548                    if ev_seq != u64::MAX {
549                        last_sent_seq = ev_seq;
550                    }
551                }
552                Err(SseError::Lagged(_)) => continue,
553                Err(SseError::ChannelClosed) => return Ok(()),
554                Err(err) => return Err(err),
555            }
556        }
557    }
558    let heartbeat_frame: Vec<u8> = SseEvent::comment_only(UPDATE_SSE_HEARTBEAT_COMMENT).encode();
559    let mut ticker: Interval = interval(Duration::from_millis(heartbeat_ms));
560    ticker.set_missed_tick_behavior(MissedTickBehavior::Delay);
561    let _: Instant = ticker.tick().await;
562    loop {
563        select! {
564            _ = ticker.tick() => {
565                stream
566                    .try_send(&heartbeat_frame)
567                    .await
568                    .map_err(|err: ResponseError| SseError::Transport(err.to_string()))?;
569            }
570            next = subscription.recv() => {
571                match next {
572                    Ok(event) => {
573                        let ev_seq: u64 = event
574                            .get_id()
575                            .as_deref()
576                            .and_then(|s: &str| s.parse::<u64>().ok())
577                            .unwrap_or(u64::MAX);
578                        if ev_seq <= last_sent_seq {
579                            continue;
580                        }
581                        SseStream::send_event_buffered(stream, &event, &mut scratch).await?;
582                        if ev_seq != u64::MAX {
583                            last_sent_seq = ev_seq;
584                        }
585                    }
586                    Err(SseError::Lagged(_)) => continue,
587                    Err(SseError::ChannelClosed) => return Ok(()),
588                    Err(err) => return Err(err),
589                }
590            }
591        }
592    }
593}
594
595/// Sends a finalized HTTP response over a Hyperlane `Stream` using HEAD-aware `ctx.build_response()`.
596///
597/// # Arguments
598///
599/// - `&mut Stream` - Active client stream.
600/// - `&mut Context` - Active Hyperlane context.
601/// - `usize` - HTTP status code.
602/// - `&str` - Response `Content-Type` header.
603/// - `Vec<u8>` - Response body bytes.
604///
605/// # Returns
606///
607/// - `Status` - `Status::Continue` or `Status::Reject` upon transport error.
608#[cfg(feature = "update-server")]
609pub(crate) async fn send_hyperlane_bytes(
610    stream: &mut Stream,
611    ctx: &mut Context,
612    status_code: usize,
613    content_type: &str,
614    body: Vec<u8>,
615) -> Status {
616    apply_update_cors_headers(ctx);
617    ctx.get_mut_response()
618        .set_status_code(status_code)
619        .set_header(CONTENT_TYPE, content_type)
620        .set_body(body);
621    let data: ResponseData = ctx.build_response();
622    if stream.try_send(&data).await.is_err() {
623        stream.set_closed(true);
624        return Status::Reject;
625    }
626    Status::Continue
627}