File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -1298,13 +1298,30 @@ ngx_http_lua_ffi_get_resp_header(ngx_http_request_t *r,
1298
1298
ngx_uint_t i ;
1299
1299
ngx_table_elt_t * h ;
1300
1300
ngx_list_part_t * part ;
1301
+ ngx_http_lua_ctx_t * ctx ;
1302
+ ngx_int_t rc ;
1301
1303
1302
1304
ngx_http_lua_loc_conf_t * llcf ;
1303
1305
1304
1306
if (r -> connection -> fd == (ngx_socket_t ) - 1 ) {
1305
1307
return NGX_HTTP_LUA_FFI_BAD_CONTEXT ;
1306
1308
}
1307
1309
1310
+ ctx = ngx_http_get_module_ctx (r , ngx_http_lua_module );
1311
+ if (ctx == NULL ) {
1312
+ // *errmsg = "no ctx found";
1313
+ return NGX_ERROR ;
1314
+ }
1315
+
1316
+ if (!ctx -> headers_set ) {
1317
+ rc = ngx_http_lua_set_content_type (r );
1318
+ if (rc != NGX_OK ) {
1319
+ // *errmsg = "failed to set default content type";
1320
+ return NGX_ERROR ;
1321
+ }
1322
+ ctx -> headers_set = 1 ;
1323
+ }
1324
+
1308
1325
llcf = ngx_http_get_module_loc_conf (r , ngx_http_lua_module );
1309
1326
if (llcf -> transform_underscores_in_resp_headers
1310
1327
&& memchr (key , '_' , key_len ) != NULL )
You can’t perform that action at this time.
0 commit comments