@@ -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://"
@@ -6029,6 +6030,13 @@ tfw_http_req_process(TfwConn *conn, TfwStream *stream, struct sk_buff *skb,
60296030 "request has been filtered out via http table" ,
60306031 HTTP2_ECODE_PROTO );
60316032 }
6033+ if (res .type == TFW_HTTP_RES_JSCH ) {
6034+ req -> need_jsch = true;
6035+ req -> vhost = res .vhost ;
6036+ }
6037+ else {
6038+ req -> need_jsch = is_jsch_global ;
6039+ }
60326040 if (res .type == TFW_HTTP_RES_VHOST ) {
60336041 req -> vhost = res .vhost ;
60346042 }
@@ -6134,37 +6142,39 @@ tfw_http_req_process(TfwConn *conn, TfwStream *stream, struct sk_buff *skb,
61346142 * to GET. We should send js challenge to the client because the real
61356143 * method, expected by the client is GET.
61366144 */
6137- switch (tfw_http_sess_obtain (req )) {
6138- case TFW_HTTP_SESS_SUCCESS :
6139- break ;
6145+ if (req -> need_jsch ) {
6146+ switch (tfw_http_sess_obtain (req )) {
6147+ case TFW_HTTP_SESS_SUCCESS :
6148+ break ;
61406149
6141- case TFW_HTTP_SESS_REDIRECT_NEED :
6142- /* Response is built and stored in @req->resp. */
6143- break ;
6150+ case TFW_HTTP_SESS_REDIRECT_NEED :
6151+ /* Response is built and stored in @req->resp. */
6152+ break ;
61446153
6145- case TFW_HTTP_SESS_VIOLATE :
6146- TFW_INC_STAT_BH (clnt .msgs_filtout );
6147- return tfw_http_req_parse_block (req , 403 , NULL ,
6148- HTTP2_ECODE_PROTO );
6154+ case TFW_HTTP_SESS_VIOLATE :
6155+ TFW_INC_STAT_BH (clnt .msgs_filtout );
6156+ return tfw_http_req_parse_block (req , 403 , NULL ,
6157+ HTTP2_ECODE_PROTO );
61496158
6150- case TFW_HTTP_SESS_JS_NOT_SUPPORTED :
6151- /*
6152- * Requested resource can't be challenged, try service it
6153- * from cache.
6154- */
6155- T_DBG ("Can't send JS challenge for request since a "
6156- "non-challengeable resource (e.g. image) was requested" );
6157- __set_bit (TFW_HTTP_B_JS_NOT_SUPPORTED , req -> flags );
6158- break ;
6159+ case TFW_HTTP_SESS_JS_NOT_SUPPORTED :
6160+ /*
6161+ * Requested resource can't be challenged, try service it
6162+ * from cache.
6163+ */
6164+ T_DBG ("Can't send JS challenge for request since a "
6165+ "non-challengeable resource (e.g. image) was requested" );
6166+ __set_bit (TFW_HTTP_B_JS_NOT_SUPPORTED , req -> flags );
6167+ break ;
61596168
6160- case TFW_HTTP_SESS_FAILURE :
6161- TFW_INC_STAT_BH (clnt .msgs_otherr );
6162- return tfw_http_req_parse_drop_with_fin (req , 500 ,
6163- "request dropped: internal error"
6164- " in Sticky module" ,
6165- HTTP2_ECODE_PROTO );
6166- default :
6167- BUG ();
6169+ case TFW_HTTP_SESS_FAILURE :
6170+ TFW_INC_STAT_BH (clnt .msgs_otherr );
6171+ return tfw_http_req_parse_drop_with_fin (req , 500 ,
6172+ "request dropped: internal error"
6173+ " in Sticky module" ,
6174+ HTTP2_ECODE_PROTO );
6175+ default :
6176+ BUG ();
6177+ }
61686178 }
61696179
61706180 if (TFW_MSG_H2 (req ))
0 commit comments