diff options
| author | fengweihao <[email protected]> | 2022-04-28 14:03:47 +0800 |
|---|---|---|
| committer | fengweihao <[email protected]> | 2022-04-28 14:03:47 +0800 |
| commit | 4c3d929d73bce8bc93d91e39fa6a2e655f1bb859 (patch) | |
| tree | 9671280d646c7f76905115964e10b29c427d2974 | |
| parent | c448188315827283d6e906d8d469442c50c13e32 (diff) | |
OMPUB-462 iOS操作系统使用Chrome浏览器访问个别HTTP2网站Deny Profile未生效v4.6.14-20220507
TSG-10278 删除Deny模板文件中系统除了信息
| -rw-r--r-- | plugin/business/pangu-http/src/pangu_http.cpp | 6 | ||||
| -rw-r--r-- | plugin/protocol/http2/src/http2_stream.cpp | 35 | ||||
| -rw-r--r-- | resource/pangu/HTTP403.html | 2 | ||||
| -rw-r--r-- | resource/pangu/HTTP404.html | 2 | ||||
| -rw-r--r-- | resource/pangu/HTTP451.html | 2 |
5 files changed, 35 insertions, 12 deletions
diff --git a/plugin/business/pangu-http/src/pangu_http.cpp b/plugin/business/pangu-http/src/pangu_http.cpp index dde4af5..2cb1bb8 100644 --- a/plugin/business/pangu-http/src/pangu_http.cpp +++ b/plugin/business/pangu-http/src/pangu_http.cpp @@ -1313,10 +1313,9 @@ static enum pangu_action decide_ctrl_action(const struct Maat_rule_t * hit_rules return prior_action; } //HTML template is downloaded from https://github.com/AndiDittrich/HttpErrorPages -static void template_generate(int status_code, int cfg_id, const char* msg, char ** page_buff, size_t * page_size) +static void template_generate(int status_code, const char* msg, char ** page_buff, size_t * page_size) { ctemplate::TemplateDictionary dict("pg_page_dict"); //dict is automatically finalized after function returned. - dict.SetIntValue("cfg_id", cfg_id); if (NULL == msg) { @@ -1366,7 +1365,6 @@ static int html_generate(int profile_id, const char* msg, char ** page_buff, siz if(!strncmp(block_profile->profile_type, "template", strlen(block_profile->profile_type))) { ctemplate::TemplateDictionary dict("pg_page_dict"); //dict is automatically finalized after function returned. - dict.SetIntValue("cfg_id", profile_id); dict.SetValue("msg", msg); std::string output; @@ -1740,7 +1738,7 @@ static void http_block(const struct tfe_stream * stream, const struct tfe_http_s message = rewrite_message; } /*read local configuration**/ - template_generate(resp_code, ctx->enforce_rules[0].config_id, message, &page_buff, &page_size); + template_generate(resp_code, message, &page_buff, &page_size); if(rewrite_message_sz>0 && rewrite_message!= NULL) { FREE(&rewrite_message); diff --git a/plugin/protocol/http2/src/http2_stream.cpp b/plugin/protocol/http2/src/http2_stream.cpp index a92bab7..2650e6f 100644 --- a/plugin/protocol/http2/src/http2_stream.cpp +++ b/plugin/protocol/http2/src/http2_stream.cpp @@ -744,6 +744,26 @@ static int http_session_update_window_size(struct tfe_h2_stream *h2_stream_info, return 1; } +static void http2_client_submit_settings(nghttp2_session *http2_client_handle, nghttp2_session *http2_server_handle) +{ + /*Check the current setting frame state is NGHTTP2_IB_READ_FIRST_SETTINGS**/ + if (http2_client_handle->iframe.state != NGHTTP2_IB_READ_FIRST_SETTINGS) + { + return; + } + nghttp2_settings_entry iv[2] = {{NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS, 100},{NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE, 65535}}; + int xret = nghttp2_submit_settings(http2_server_handle, NGHTTP2_FLAG_NONE, iv, 2); + if (xret != 0) + { + TFE_LOG_ERROR(logger()->handle, "Submit settings error: %s\n", nghttp2_strerror(xret)); + } + xret = nghttp2_session_send(http2_server_handle); + if (xret != 0) { + TFE_LOG_ERROR(logger()->handle, "Fatal send error: %s\n", nghttp2_strerror(xret)); + } + return; +} + static enum tfe_stream_action http2_frame_submit_built_resp(struct tfe_h2_stream *h2_stream_info, struct tfe_h2_session *h2_session) { int rv = -1; @@ -786,6 +806,7 @@ static enum tfe_stream_action http2_frame_submit_built_resp(struct tfe_h2_stream tfe_http_field_write(&pangu_resp->half_public, &encoding_field, content_encoding); } http_session_update_window_size(h2_stream_info, h2_session, evbuffer_get_length(body->evbuf_body)); + http2_client_submit_settings(h2_stream_info->http2_client_handle,h2_stream_info->http2_server_handle); nghttp2_data_provider data_prd; data_prd.source.ptr = (void *)body; @@ -1091,7 +1112,6 @@ void http2_disect_goaway(struct tfe_h2_stream *h2_stream_info) static int http2_submit_frame_goaway(struct tfe_h2_stream *connection, const nghttp2_frame *frame, enum tfe_conn_dir dir) { int xret = -1; - const char *opaque_data = NULL; enum tfe_stream_action stream_action = ACTION_DROP_DATA; const nghttp2_goaway *goaway = &frame->goaway; @@ -1112,9 +1132,8 @@ static int http2_submit_frame_goaway(struct tfe_h2_stream *connection, const ngh dir, nghttp2_strerror(xret)); } finish: - opaque_data = ((const char *)goaway->opaque_data) != NULL ? (char *)goaway->opaque_data : "-"; - TFE_LOG_DEBUG(logger()->handle, "%s, %d, submit goaway, stream_id:%d, action:%d, errod_code:%d, data:%s", connection->tf_stream->str_stream_info, - dir, goaway->last_stream_id, connection->stream_action, goaway->error_code, opaque_data); + TFE_LOG_DEBUG(logger()->handle, "%s, %d, submit goaway, stream_id:%d, action:%d, errod_code:%d, data:%.*s", connection->tf_stream->str_stream_info, + dir, goaway->last_stream_id, connection->stream_action, goaway->error_code, goaway->opaque_data_len, goaway->opaque_data); connection->goaway = 1; connection->stream_action = stream_action; return 0; @@ -1715,6 +1734,10 @@ static enum tfe_stream_action http2_client_frame_submit_header(struct tfe_h2_str if (h2_session->plugin_built_resp) { stream_action = http2_submit_built_response(h2_stream_info, h2_session); + if(stream_action == ACTION_USER_DATA) + { + nghttp2_session_terminate_session(h2_stream_info->http2_client_handle, 0); + } return stream_action; } headers = &req->header; @@ -1726,7 +1749,9 @@ static enum tfe_stream_action http2_client_frame_submit_header(struct tfe_h2_str method = http2_get_method(h2_session->req); if (method == (enum tfe_http_std_method)HTTP_REQUEST_METHOD_POST || method == (enum tfe_http_std_method)HTTP_REQUEST_METHOD_PUT) { - if (h2_session->plugin_built_req != NULL) + const struct http_field_name field = {TFE_HTTP_CONT_LENGTH, NULL}; + const char *content_length = h2_half_ops_field_read(&(h2_session->req->half_public), &field); + if ((h2_session->plugin_built_req != NULL) && (atoi(content_length) != 0)) { stream_action = (enum tfe_stream_action)ACTION_USER_DATA; return stream_action; diff --git a/resource/pangu/HTTP403.html b/resource/pangu/HTTP403.html index 53821c5..f322c27 100644 --- a/resource/pangu/HTTP403.html +++ b/resource/pangu/HTTP403.html @@ -7,7 +7,7 @@ <style type="text/css">html{font-family:sans-serif;line-height:1.15;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,footer,header,nav,section{display:block}h1{font-size:2em;margin:.67em 0}figcaption,figure,main{display:block}figure{margin:1em 40px}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent;-webkit-text-decoration-skip:objects}a:active,a:hover{outline-width:0}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:inherit}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}dfn{font-style:italic}mark{background-color:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}audio,video{display:inline-block}audio:not([controls]){display:none;height:0}img{border-style:none}svg:not(:root){overflow:hidden}button,input,optgroup,select,textarea{font-family:sans-serif;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=reset],[type=submit],button,html [type=button]{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{display:inline-block;vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details,menu{display:block}summary{display:list-item}canvas{display:inline-block}template{display:none}[hidden]{display:none}body,html{width:100%;height:100%;background-color:#21232a}body{color:#fff;text-align:center;text-shadow:0 2px 4px rgba(0,0,0,.5);padding:0;min-height:100%;-webkit-box-shadow:inset 0 0 100px rgba(0,0,0,.8);box-shadow:inset 0 0 100px rgba(0,0,0,.8);display:table;font-family:"Open Sans",Arial,sans-serif}h1{font-family:inherit;font-weight:500;line-height:1.1;color:inherit;font-size:36px}h1 small{font-size:68%;font-weight:400;line-height:1;color:#777}a{text-decoration:none;color:#fff;font-size:inherit;border-bottom:dotted 1px #707070}.lead{color:silver;font-size:21px;line-height:1.4}.cover{display:table-cell;vertical-align:middle;padding:0 20px}footer{position:fixed;width:100%;height:40px;left:0;bottom:0;color:#a0a0a0;font-size:14px}</style> </head> <body> - <div class="cover"><h1>Access Denied <small>Error 403</small></h1><p class="lead">The requested resource requires an authentication (TFE-{{cfg_id}}:{{msg}}).</p></div> + <div class="cover"><h1>Access Denied <small>Error 403</small></h1><p class="lead">The requested resource requires an authentication ({{msg}}).</p></div> </body> </html> diff --git a/resource/pangu/HTTP404.html b/resource/pangu/HTTP404.html index 2a89476..3e705a5 100644 --- a/resource/pangu/HTTP404.html +++ b/resource/pangu/HTTP404.html @@ -7,7 +7,7 @@ <style type="text/css">html{font-family:sans-serif;line-height:1.15;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,footer,header,nav,section{display:block}h1{font-size:2em;margin:.67em 0}figcaption,figure,main{display:block}figure{margin:1em 40px}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent;-webkit-text-decoration-skip:objects}a:active,a:hover{outline-width:0}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:inherit}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}dfn{font-style:italic}mark{background-color:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}audio,video{display:inline-block}audio:not([controls]){display:none;height:0}img{border-style:none}svg:not(:root){overflow:hidden}button,input,optgroup,select,textarea{font-family:sans-serif;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=reset],[type=submit],button,html [type=button]{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{display:inline-block;vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details,menu{display:block}summary{display:list-item}canvas{display:inline-block}template{display:none}[hidden]{display:none}body,html{width:100%;height:100%;background-color:#21232a}body{color:#fff;text-align:center;text-shadow:0 2px 4px rgba(0,0,0,.5);padding:0;min-height:100%;-webkit-box-shadow:inset 0 0 100px rgba(0,0,0,.8);box-shadow:inset 0 0 100px rgba(0,0,0,.8);display:table;font-family:"Open Sans",Arial,sans-serif}h1{font-family:inherit;font-weight:500;line-height:1.1;color:inherit;font-size:36px}h1 small{font-size:68%;font-weight:400;line-height:1;color:#777}a{text-decoration:none;color:#fff;font-size:inherit;border-bottom:dotted 1px #707070}.lead{color:silver;font-size:21px;line-height:1.4}.cover{display:table-cell;vertical-align:middle;padding:0 20px}footer{position:fixed;width:100%;height:40px;left:0;bottom:0;color:#a0a0a0;font-size:14px}</style> </head> <body> - <div class="cover"><h1>Resource not found <small>Error 404 </small></h1><p class="lead">The requested resource could not be found but may be available again in the future (TFE-{{cfg_id}}:{{msg}}).</p></div> + <div class="cover"><h1>Resource not found <small>Error 404 </small></h1><p class="lead">The requested resource could not be found but may be available again in the future ({{msg}}).</p></div> </body> </html> diff --git a/resource/pangu/HTTP451.html b/resource/pangu/HTTP451.html index 8fe9a15..a7fb9fc 100644 --- a/resource/pangu/HTTP451.html +++ b/resource/pangu/HTTP451.html @@ -7,7 +7,7 @@ <style type="text/css">html{font-family:sans-serif;line-height:1.15;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,footer,header,nav,section{display:block}h1{font-size:2em;margin:.67em 0}figcaption,figure,main{display:block}figure{margin:1em 40px}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace,monospace;font-size:1em}a{background-color:transparent;-webkit-text-decoration-skip:objects}a:active,a:hover{outline-width:0}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:inherit}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace,monospace;font-size:1em}dfn{font-style:italic}mark{background-color:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}audio,video{display:inline-block}audio:not([controls]){display:none;height:0}img{border-style:none}svg:not(:root){overflow:hidden}button,input,optgroup,select,textarea{font-family:sans-serif;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=reset],[type=submit],button,html [type=button]{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{display:inline-block;vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}details,menu{display:block}summary{display:list-item}canvas{display:inline-block}template{display:none}[hidden]{display:none}body,html{width:100%;height:100%;background-color:#21232a}body{color:#fff;text-align:center;text-shadow:0 2px 4px rgba(0,0,0,.5);padding:0;min-height:100%;-webkit-box-shadow:inset 0 0 100px rgba(0,0,0,.8);box-shadow:inset 0 0 100px rgba(0,0,0,.8);display:table;font-family:"Open Sans",Arial,sans-serif}h1{font-family:inherit;font-weight:500;line-height:1.1;color:inherit;font-size:36px}h1 small{font-size:68%;font-weight:400;line-height:1;color:#777}a{text-decoration:none;color:#fff;font-size:inherit;border-bottom:dotted 1px #707070}.lead{color:silver;font-size:21px;line-height:1.4}.cover{display:table-cell;vertical-align:middle;padding:0 20px}footer{position:fixed;width:100%;height:40px;left:0;bottom:0;color:#a0a0a0;font-size:14px}</style> </head> <body> - <div class="cover"><h1>Unavailable For Legal Reasons <small>Error 451</small></h1><p class="lead">This request may not be serviced due to the regulations of your residency (TFE-{{cfg_id}}:{{msg}}).</p></div> + <div class="cover"><h1>Unavailable For Legal Reasons <small>Error 451</small></h1><p class="lead">This request may not be serviced due to the regulations of your residency ({{msg}}).</p></div> </body> </html> |
