@@ -133,13 +133,7 @@ static void ngx_http_link_func_client_body_handler(ngx_http_request_t *r);
133
133
static ngx_int_t ngx_http_link_func_proceed_init_calls (ngx_cycle_t * cycle , ngx_http_link_func_srv_conf_t * scf , ngx_http_link_func_main_conf_t * mcf );
134
134
static u_char * ngx_http_link_func_strdup_with_p (ngx_pool_t * pool , const char * src , size_t len );
135
135
136
- // static ngx_int_t ngx_http_link_func_get_resp_var(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data);
137
- // static void ngx_http_link_func_set_resp_var_with_r(ngx_http_request_t *r, ngx_link_func_ctx_t *ctx, const char* resp_content, size_t resp_len);
138
- // #if (NGX_THREADS) && (nginx_version > 1013003)
139
- // static void ngx_http_link_func_output_filter(ngx_http_request_t *r);
140
- // #else
141
136
static ngx_int_t ngx_http_link_func_output_filter (ngx_http_request_t * r );
142
- // #endif
143
137
144
138
#if (NGX_THREADS ) && (nginx_version > 1013003 )
145
139
static void ngx_http_link_func_after_process (ngx_event_t * ev );
@@ -423,7 +417,6 @@ ngx_http_link_func_validation_check_and_set_str_slot(ngx_conf_t *cf, ngx_command
423
417
return NGX_CONF_OK ;
424
418
}
425
419
426
-
427
420
// static char *ngx_http_link_func_srv_post_conf_handler(ngx_conf_t *cf, void *data, void *conf) {
428
421
// ngx_str_t *value = conf;
429
422
// ngx_http_link_func_srv_conf_t *scf = ngx_http_conf_get_module_srv_conf(cf, ngx_http_link_func_module);
@@ -1009,12 +1002,7 @@ ngx_http_link_func_precontent_handler(ngx_http_request_t *r) {
1009
1002
if (internal_ctx -> aio_processing ) {
1010
1003
return NGX_AGAIN ;
1011
1004
} else {
1012
- // #if (NGX_THREADS) && (nginx_version > 1013003)
1013
- // ngx_http_link_func_output_filter(r);
1014
- // return NGX_OK;
1015
- // #else
1016
1005
return NGX_DECLINED ;
1017
- // #endif
1018
1006
}
1019
1007
1020
1008
new_task :
@@ -1024,8 +1012,8 @@ ngx_http_link_func_precontent_handler(ngx_http_request_t *r) {
1024
1012
new_ctx -> __log__ = r -> connection -> log ;
1025
1013
new_ctx -> shared_mem = (void * )mcf -> shm_ctx -> shared_mem ;
1026
1014
1027
- /***Set to default incase link library does not return anything ***/
1028
- internal_ctx -> rc = NGX_HTTP_INTERNAL_SERVER_ERROR ;
1015
+ /***Set to NGX_HTTP_NOT_FOUND incase function handler or it has subrequest does not return anything ***/
1016
+ internal_ctx -> rc = NGX_HTTP_NOT_FOUND ;
1029
1017
1030
1018
if (r -> args .len > 0 ) {
1031
1019
new_ctx -> req_args = ngx_pcalloc (r -> pool , r -> args .len + 1 );
@@ -1613,14 +1601,6 @@ ngx_link_func_write_resp_l(
1613
1601
1614
1602
ngx_http_request_t * r = (ngx_http_request_t * )appctx -> __r__ ;
1615
1603
1616
- // if ( ((ngx_http_link_func_loc_conf_t*) ngx_http_get_module_loc_conf(r, ngx_http_link_func_module) )->_is_call_to_var ) {
1617
- // ngx_log_error(NGX_LOG_WARN,
1618
- // r->connection->log,
1619
- // 0, "Recommended to call ngx_http_link_func_set_resp_var. ngx_http_link_func_write_resp only applicable when no variable specified");
1620
- // ngx_http_link_func_set_resp_var_with_r(r, appctx, resp_content, resp_content_len);
1621
- // return;
1622
- // }
1623
-
1624
1604
internal_ctx = ngx_http_get_module_ctx (r , ngx_http_link_func_module );
1625
1605
1626
1606
if (internal_ctx == NULL ) {
@@ -1682,69 +1662,6 @@ ngx_link_func_write_resp(
1682
1662
);
1683
1663
}
1684
1664
1685
- // #if (NGX_THREADS) && (nginx_version > 1013003)
1686
- // static void
1687
- // ngx_http_link_func_output_filter(
1688
- // ngx_http_request_t *r
1689
- // ) {
1690
- // ngx_int_t rc;
1691
- // ngx_chain_t out;
1692
- // ngx_http_link_func_internal_ctx_t *internal_ctx;
1693
- // ngx_str_t *resp_content_type, *resp_status_line;
1694
- // ngx_buf_t *b;
1695
-
1696
- // internal_ctx = ngx_http_get_module_ctx(r, ngx_http_link_func_module);
1697
-
1698
- // if (internal_ctx == NULL) {
1699
- // ngx_log_error(NGX_LOG_EMERG, r->connection->log, 0, "Session is not valid");
1700
- // ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
1701
- // return;
1702
- // }
1703
-
1704
- // if (internal_ctx->rc == NGX_HTTP_INTERNAL_SERVER_ERROR) {
1705
- // ngx_log_error(NGX_LOG_EMERG, r->connection->log, 0, "Apps Internal Server error");
1706
- // ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
1707
- // return;
1708
- // }
1709
-
1710
- // resp_status_line = &internal_ctx->status_line;
1711
- // resp_content_type = &internal_ctx->content_type;
1712
- // b = internal_ctx->resp_content;
1713
-
1714
- // r->headers_out.status = internal_ctx->status_code;
1715
-
1716
- // if (resp_status_line->len) {
1717
- // r->headers_out.status_line.len = resp_status_line->len;
1718
- // r->headers_out.status_line.data = resp_status_line->data;
1719
- // }
1720
-
1721
- // /* Set the Content-Type header. */
1722
- // r->headers_out.content_type.len = resp_content_type->len;
1723
- // r->headers_out.content_type.data = resp_content_type->data;
1724
-
1725
- // /* Get the content length of the body. */
1726
- // r->headers_out.content_length_n = ngx_buf_size(b);
1727
-
1728
- // rc = ngx_http_send_header(r); /* Send the headers */
1729
- // if (rc == NGX_ERROR) {
1730
- // ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "response processing failed.");
1731
- // // ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
1732
- // rc = NGX_HTTP_INTERNAL_SERVER_ERROR;
1733
- // ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
1734
- // return;
1735
-
1736
- // }
1737
-
1738
- // /* Insertion in the buffer chain. */
1739
- // out.buf = b;
1740
- // out.next = NULL; /* just one buffer */
1741
-
1742
- // /* Send the body, and return the status code of the output filter chain. */
1743
- // // ngx_http_finalize_request(r, ngx_http_output_filter(r, &out)); // only using when request client body
1744
- // // rc = ngx_http_output_filter(r, &out);
1745
- // ngx_http_output_filter(r, &out);
1746
- // }
1747
- // #else
1748
1665
static ngx_int_t
1749
1666
ngx_http_link_func_output_filter (
1750
1667
ngx_http_request_t * r
@@ -1762,9 +1679,9 @@ ngx_http_link_func_output_filter(
1762
1679
return NGX_HTTP_INTERNAL_SERVER_ERROR ;
1763
1680
}
1764
1681
1765
- if (internal_ctx -> rc == NGX_HTTP_INTERNAL_SERVER_ERROR ) {
1766
- ngx_log_error ( NGX_LOG_EMERG , r -> connection -> log , 0 , "Apps Internal Server error" );
1767
- return NGX_HTTP_INTERNAL_SERVER_ERROR ;
1682
+ if (internal_ctx -> rc == NGX_HTTP_NOT_FOUND ) {
1683
+ /** might not handle content phase, request routed to the next handler **/
1684
+ return NGX_HTTP_NOT_FOUND ;
1768
1685
}
1769
1686
1770
1687
resp_status_line = & internal_ctx -> status_line ;
@@ -1800,7 +1717,6 @@ ngx_http_link_func_output_filter(
1800
1717
// ngx_http_finalize_request(r, ngx_http_output_filter(r, &out)); // only using when request client body
1801
1718
return ngx_http_output_filter (r , & out );
1802
1719
}
1803
- // #endif
1804
1720
1805
1721
/****Download Feature Support ****/
1806
1722
static int
0 commit comments