File tree Expand file tree Collapse file tree 3 files changed +49
-4
lines changed
integration-tests/js-compute/fixtures/app
runtime/js-compute-runtime/host_interface/component Expand file tree Collapse file tree 3 files changed +49
-4
lines changed Original file line number Diff line number Diff line change
1
+ /// <reference path="../../../../../types/index.d.ts" />
1
2
import { Backend } from 'fastly:backend' ;
2
3
import { CacheOverride } from 'fastly:cache-override' ;
3
4
import { allowDynamicBackends } from "fastly:experimental" ;
@@ -6,6 +7,33 @@ import { isRunningLocally, routes } from "./routes.js";
6
7
7
8
/// The backend name is already in use.
8
9
10
+ routes . set ( "/backend/timeout" , async ( ) => {
11
+ if ( isRunningLocally ( ) ) {
12
+ return pass ( 'ok' )
13
+ }
14
+ allowDynamicBackends ( true ) ;
15
+ let backend = new Backend (
16
+ {
17
+ name : 'httpme1' ,
18
+ target : 'http-me.glitch.me' ,
19
+ hostOverride : "http-me.glitch.me" ,
20
+ useSSL : true ,
21
+ dontPool : true ,
22
+ betweenBytesTimeout : 1_000 ,
23
+ connectTimeout : 1_000 ,
24
+ firstByteTimeout : 1_000
25
+ }
26
+ ) ;
27
+ console . time ( `fetch('https://http-me.glitch.me/test?wait=5000'` )
28
+ let error = await assertRejects ( ( ) => fetch ( 'https://http-me.glitch.me/test?wait=5000' , {
29
+ backend,
30
+ cacheOverride : new CacheOverride ( "pass" ) ,
31
+ } ) ) ;
32
+ console . timeEnd ( `fetch('https://http-me.glitch.me/test?wait=5000'` )
33
+ if ( error ) { return error }
34
+ return pass ( 'ok' )
35
+ } ) ;
36
+
9
37
10
38
// implicit dynamic backend
11
39
{
Original file line number Diff line number Diff line change 2131
2131
"body" : " ok"
2132
2132
}
2133
2133
},
2134
+ "GET /backend/timeout" : {
2135
+ "environments" : [" compute" ],
2136
+ "downstream_request" : {
2137
+ "method" : " GET" ,
2138
+ "pathname" : " /backend/timeout"
2139
+ },
2140
+ "downstream_response" : {
2141
+ "status" : 200 ,
2142
+ "body" : " ok"
2143
+ }
2144
+ },
2134
2145
"GET /implicit-dynamic-backend/dynamic-backends-disabled" : {
2135
2146
"environments" : [" viceroy" ],
2136
2147
"downstream_request" : {
Original file line number Diff line number Diff line change @@ -496,17 +496,23 @@ bool fastly_compute_at_edge_http_req_register_dynamic_backend(
496
496
fastly_compute_at_edge_types_error_t *err) {
497
497
uint32_t backend_config_mask = 0 ;
498
498
499
+ if (config->use_ssl .is_some && config->use_ssl .val ) {
500
+ backend_config_mask |= BACKEND_CONFIG_USE_SSL;
501
+ }
502
+ if (config->dont_pool .is_some && config->dont_pool .val ) {
503
+ backend_config_mask |= BACKEND_CONFIG_DONT_POOL;
504
+ }
499
505
if (config->host_override .is_some ) {
500
506
backend_config_mask |= BACKEND_CONFIG_HOST_OVERRIDE;
501
507
}
502
508
if (config->connect_timeout .is_some ) {
503
509
backend_config_mask |= BACKEND_CONFIG_CONNECT_TIMEOUT;
504
510
}
505
- if (config->use_ssl .is_some && config-> use_ssl . val ) {
506
- backend_config_mask |= BACKEND_CONFIG_USE_SSL ;
511
+ if (config->first_byte_timeout .is_some ) {
512
+ backend_config_mask |= BACKEND_CONFIG_FIRST_BYTE_TIMEOUT ;
507
513
}
508
- if (config->dont_pool .is_some && config-> dont_pool . val ) {
509
- backend_config_mask |= BACKEND_CONFIG_DONT_POOL ;
514
+ if (config->between_bytes_timeout .is_some ) {
515
+ backend_config_mask |= BACKEND_CONFIG_BETWEEN_BYTES_TIMEOUT ;
510
516
}
511
517
if (config->ssl_min_version .is_some ) {
512
518
backend_config_mask |= BACKEND_CONFIG_SSL_MIN_VERSION;
You can’t perform that action at this time.
0 commit comments