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