@@ -150,6 +150,7 @@ static struct {
150150 * here, because it refers to HTTP layer.
151151 */
152152unsigned int max_header_list_size = 0 ;
153+ bool is_jsch_global = true;
153154
154155#define S_CRLFCRLF "\r\n\r\n"
155156#define S_HTTP "http://"
@@ -6034,6 +6035,13 @@ tfw_http_req_process(TfwConn *conn, TfwStream *stream, struct sk_buff *skb,
60346035 "request has been filtered out via http table" ,
60356036 HTTP2_ECODE_PROTO );
60366037 }
6038+ if (res .type == TFW_HTTP_RES_JSCH ) {
6039+ req -> need_jsch = true;
6040+ req -> vhost = res .vhost ;
6041+ }
6042+ else {
6043+ req -> need_jsch = is_jsch_global ;
6044+ }
60376045 if (res .type == TFW_HTTP_RES_VHOST ) {
60386046 req -> vhost = res .vhost ;
60396047 }
@@ -6139,37 +6147,39 @@ tfw_http_req_process(TfwConn *conn, TfwStream *stream, struct sk_buff *skb,
61396147 * to GET. We should send js challenge to the client because the real
61406148 * method, expected by the client is GET.
61416149 */
6142- switch (tfw_http_sess_obtain (req )) {
6143- case TFW_HTTP_SESS_SUCCESS :
6144- break ;
6150+ if (req -> need_jsch ) {
6151+ switch (tfw_http_sess_obtain (req )) {
6152+ case TFW_HTTP_SESS_SUCCESS :
6153+ break ;
61456154
6146- case TFW_HTTP_SESS_REDIRECT_NEED :
6147- /* Response is built and stored in @req->resp. */
6148- break ;
6155+ case TFW_HTTP_SESS_REDIRECT_NEED :
6156+ /* Response is built and stored in @req->resp. */
6157+ break ;
61496158
6150- case TFW_HTTP_SESS_VIOLATE :
6151- TFW_INC_STAT_BH (clnt .msgs_filtout );
6152- return tfw_http_req_parse_block (req , 403 , NULL ,
6153- HTTP2_ECODE_PROTO );
6159+ case TFW_HTTP_SESS_VIOLATE :
6160+ TFW_INC_STAT_BH (clnt .msgs_filtout );
6161+ return tfw_http_req_parse_block (req , 403 , NULL ,
6162+ HTTP2_ECODE_PROTO );
61546163
6155- case TFW_HTTP_SESS_JS_NOT_SUPPORTED :
6156- /*
6157- * Requested resource can't be challenged, try service it
6158- * from cache.
6159- */
6160- T_DBG ("Can't send JS challenge for request since a "
6161- "non-challengeable resource (e.g. image) was requested" );
6162- __set_bit (TFW_HTTP_B_JS_NOT_SUPPORTED , req -> flags );
6163- break ;
6164+ case TFW_HTTP_SESS_JS_NOT_SUPPORTED :
6165+ /*
6166+ * Requested resource can't be challenged, try service it
6167+ * from cache.
6168+ */
6169+ T_DBG ("Can't send JS challenge for request since a "
6170+ "non-challengeable resource (e.g. image) was requested" );
6171+ __set_bit (TFW_HTTP_B_JS_NOT_SUPPORTED , req -> flags );
6172+ break ;
61646173
6165- case TFW_HTTP_SESS_FAILURE :
6166- TFW_INC_STAT_BH (clnt .msgs_otherr );
6167- return tfw_http_req_parse_drop_with_fin (req , 500 ,
6168- "request dropped: internal error"
6169- " in Sticky module" ,
6170- HTTP2_ECODE_PROTO );
6171- default :
6172- BUG ();
6174+ case TFW_HTTP_SESS_FAILURE :
6175+ TFW_INC_STAT_BH (clnt .msgs_otherr );
6176+ return tfw_http_req_parse_drop_with_fin (req , 500 ,
6177+ "request dropped: internal error"
6178+ " in Sticky module" ,
6179+ HTTP2_ECODE_PROTO );
6180+ default :
6181+ BUG ();
6182+ }
61736183 }
61746184
61756185 if (TFW_MSG_H2 (req ))
0 commit comments