• R/O
  • HTTP
  • SSH
  • HTTPS

ultramonkey-l7-v3: Commit

UltraMonkey-L7 V3(multi-thread implementation)


Commit MetaInfo

Revisão8e3dce06bb41ee524fec4d4eae86023a59efdde7 (tree)
Hora2013-01-22 17:07:51
Autortakeda kenji <takeda@deve...>
Commitertakeda kenji

Mensagem de Log

主要な変更:
・Sorryサーバに接続できなかった場合、status=FINALIZEを返すようにした。
・handle_realserver_selectの中で宛先RealServerが見つからなかったときに
SorryフラグをONにするが、このとき同時に編集区分をONにするようにした。
・HTTPメソッド、バージョンのチェックを行うようにした。
・Debugログ出力を出力できるようにした。

Mudança Sumário

Diff

--- a/l7vsd/module/protocol/protocol_module_url.cpp
+++ b/l7vsd/module/protocol/protocol_module_url.cpp
@@ -685,14 +685,6 @@ protocol_module_base::check_message_result protocol_module_url::set_parameter(co
685685 std::string > & args)
686686 {
687687
688- /* 基本的にcheck_parameterと同じ。ただし、
689- * ・check_parameter時から不要なコードに関してはコメントアウト
690- * ・check_parameter時から追加したコードに関してはその旨をコメント
691- * という形で編集しておく。2011/11/30 10:15
692- *
693- * データ構造の変更に伴うコード修正を行った 2011/12/10 17:59
694- */
695-
696688 /*-------- DEBUG LOG --------*/
697689 if (unlikely(LOG_LV_DEBUG == getloglevel())) {
698690 boost::format formatter("in_function : protocol_module_base::check_message_result "
@@ -760,7 +752,7 @@ protocol_module_base::check_message_result protocol_module_url::set_parameter(co
760752 typedef boost::asio::ip::tcp tcp_type;
761753
762754 //set forwarded flag true
763- forwarded_for = FORWARDED_FOR_ON; // @taeda:単なる間違い記述?
755+ forwarded_for = FORWARDED_FOR_ON;
764756
765757 try {
766758 vec_str_it it = args.begin();
@@ -1048,7 +1040,7 @@ protocol_module_base::check_message_result protocol_module_url::set_parameter(co
10481040 formatter % check_result.flag % check_result.message;
10491041 putLogDebug(100016, formatter.str(), __FILE__, __LINE__);
10501042 }
1051-
1043+
10521044 return check_result;
10531045
10541046 }
@@ -2491,7 +2483,6 @@ protocol_module_base::EVENT_TAG protocol_module_url::handle_client_recv(const bo
24912483 protocol_module_base::EVENT_TAG protocol_module_url::handle_realserver_select(
24922484 const boost::thread::id thread_id, boost::asio::ip::tcp::endpoint &rs_endpoint)
24932485 {
2494-
24952486 /*-------- DEBUG LOG --------*/
24962487 if (unlikely(LOG_LV_DEBUG == getloglevel())) {
24972488 boost::format formatter("in_function : protocol_module_base::EVENT_TAG protocol_module_url::"
@@ -2636,9 +2627,42 @@ protocol_module_base::EVENT_TAG protocol_module_url::handle_realserver_select(
26362627 session_data->target_endpoint = rs_endpoint;
26372628 status = REALSERVER_CONNECT;
26382629 }else{
2639- // no endpoint found
2630+ // endpoint not found
26402631 // set sorry flag on
26412632 session_data->sorry_flag = SORRY_FLAG_ON;
2633+
2634+ CHECK_RESULT_TAG check_result;
2635+ // check http method
2636+ check_result = check_http_method( recv_data.receive_buffer + it->send_offset, it->send_possible_size );
2637+ /*-------- DEBUG LOG --------*/
2638+ if (unlikely(LOG_LV_DEBUG == getloglevel())) {
2639+ boost::format formatter("function : protocol_module_base::EVENT_TAG protocol_module_url::"
2640+ "handle_realserver_select() : call check_http_method : "
2641+ "return_value = %d. thread id : %d.");
2642+ formatter % check_result % boost::this_thread::get_id();
2643+ putLogDebug(100061, formatter.str(), __FILE__, __LINE__);
2644+ }
2645+ /*------DEBUG LOG END------*/
2646+
2647+ // check http method result is CHECK_OK
2648+ if (check_result == CHECK_OK) {
2649+ //check http version
2650+ check_result = check_http_version( recv_data.receive_buffer + it->send_offset, it->send_possible_size );
2651+ /*-------- DEBUG LOG --------*/
2652+ if (unlikely(LOG_LV_DEBUG == getloglevel())) {
2653+ boost::format formatter("function : protocol_module_base::EVENT_TAG protocol_module_url::"
2654+ "handle_realserver_select() : call check_http_version : "
2655+ "return_value = %d. thread id : %d.");
2656+ formatter % check_result % boost::this_thread::get_id();
2657+ putLogDebug(100062, formatter.str(), __FILE__, __LINE__);
2658+ }
2659+ /*------DEBUG LOG END------*/
2660+ }
2661+
2662+ if( check_result == CHECK_OK ){
2663+ it->edit_division = EDIT_DIVISION_EDIT;
2664+ }
2665+
26422666 /*-------- DEBUG LOG --------*/
26432667 if (unlikely(LOG_LV_DEBUG == getloglevel())) {
26442668 boost::format formatter("function : protocol_module_base::EVENT_TAG protocol_module_url::"
@@ -2647,6 +2671,9 @@ protocol_module_base::EVENT_TAG protocol_module_url::handle_realserver_select(
26472671 putLogDebug(100076, formatter.str(), __FILE__, __LINE__);
26482672 }
26492673 /*------DEBUG LOG END------*/
2674+
2675+ putLogError(9999, "There is no realserver on list.", __FILE__, __LINE__);
2676+
26502677 status = SORRYSERVER_SELECT;
26512678 }
26522679 }else{
@@ -2688,8 +2715,8 @@ protocol_module_base::EVENT_TAG protocol_module_url::handle_realserver_select(
26882715 formatter % e % boost::this_thread::get_id();
26892716 putLogDebug(100077, formatter.str(), __FILE__, __LINE__);
26902717 }
2691- status = FINALIZE;
26922718 /*------DEBUG LOG END------*/
2719+ status = FINALIZE;
26932720 } catch (const std::exception &ex) {
26942721 std::cerr << "protocol_module_url::handle_realserver_select() : exception : error = " << ex.what() << "." << std::endl;
26952722 boost::format formatter("function : protocol_module_base::EVENT_TAG protocol_module_url::"
@@ -3602,7 +3629,6 @@ protocol_module_base::EVENT_TAG protocol_module_url::handle_sorryserver_select(
36023629 protocol_module_base::EVENT_TAG protocol_module_url::handle_sorryserver_connect(
36033630 const boost::thread::id thread_id, boost::array<char, MAX_BUFFER_SIZE>& sendbuffer, size_t &datalen)
36043631 {
3605-
36063632 /*-------- DEBUG LOG --------*/
36073633 if (unlikely(LOG_LV_DEBUG == getloglevel())) {
36083634 boost::format formatter("in_function : protocol_module_base::EVENT_TAG protocol_module_url::"
@@ -3693,6 +3719,7 @@ protocol_module_base::EVENT_TAG protocol_module_url::handle_sorryserver_connect(
36933719 edata.replace_size = 0;
36943720 //search uri
36953721 if (strlen(sorry_uri.data()) > 0) {
3722+
36963723 ret = find_uri(recv_data.receive_buffer + it->send_offset, it->send_possible_size, url_offset,
36973724 url_offset_len);
36983725 /*-------- DEBUG LOG --------*/
@@ -4160,7 +4187,6 @@ handle_sorryserver_connect_out:
41604187 protocol_module_base::EVENT_TAG protocol_module_url::handle_sorryserver_connection_fail(
41614188 const boost::thread::id thread_id, const boost::asio::ip::tcp::endpoint &sorry_endpoint)
41624189 {
4163-
41644190 /*-------- DEBUG LOG --------*/
41654191 if (unlikely(LOG_LV_DEBUG == getloglevel())) {
41664192 boost::format formatter("in_function : protocol_module_base::EVENT_TAG protocol_module_url::"
@@ -4200,7 +4226,7 @@ protocol_module_base::EVENT_TAG protocol_module_url::handle_sorryserver_connecti
42004226 }
42014227 /*------DEBUG LOG END------*/
42024228
4203- status = CLIENT_DISCONNECT;
4229+ status = FINALIZE;
42044230 } catch (int e) {
42054231 /*-------- DEBUG LOG --------*/
42064232 if (unlikely(LOG_LV_DEBUG == getloglevel())) {
@@ -4428,7 +4454,6 @@ protocol_module_base::EVENT_TAG protocol_module_url::handle_realserver_recv(
44284454 const boost::thread::id thread_id, const boost::asio::ip::tcp::endpoint &rs_endpoint, const boost::array < char,
44294455 MAX_BUFFER_SIZE > & recvbuffer, const size_t recvlen)
44304456 {
4431-
44324457 /*-------- DEBUG LOG --------*/
44334458 if (unlikely(LOG_LV_DEBUG == getloglevel())) {
44344459 size_t buffer_size = recvbuffer.size() < recvlen ? recvbuffer.size() : recvlen;
@@ -5410,7 +5435,6 @@ protocol_module_base::EVENT_TAG protocol_module_url::handle_sorryserver_recv(
54105435 const boost::thread::id thread_id, const boost::asio::ip::tcp::endpoint &sorry_endpoint, const boost::array <
54115436 char, MAX_BUFFER_SIZE > & recvbuffer, const size_t recvlen)
54125437 {
5413-
54145438 /*-------- DEBUG LOG --------*/
54155439 if (unlikely(LOG_LV_DEBUG == getloglevel())) {
54165440 size_t buffer_size = recvbuffer.size() < recvlen ? recvbuffer.size() : recvlen;
@@ -6576,7 +6600,6 @@ protocol_module_base::EVENT_TAG protocol_module_url::handle_client_select(
65766600 protocol_module_base::EVENT_TAG protocol_module_url::handle_client_send(
65776601 const boost::thread::id thread_id)
65786602 {
6579-
65806603 /*-------- DEBUG LOG --------*/
65816604 if (unlikely(LOG_LV_DEBUG == getloglevel())) {
65826605 boost::format formatter("in_function : protocol_module_base::EVENT_TAG protocol_module_url::"
@@ -6744,7 +6767,6 @@ protocol_module_base::EVENT_TAG protocol_module_url::handle_client_disconnect(
67446767 protocol_module_base::EVENT_TAG protocol_module_url::handle_sorry_enable(
67456768 const boost::thread::id thread_id)
67466769 {
6747-
67486770 /*-------- DEBUG LOG --------*/
67496771 if (unlikely(LOG_LV_DEBUG == getloglevel())) {
67506772 boost::format formatter("in_function : protocol_module_base::EVENT_TAG protocol_module_url::"
@@ -6997,7 +7019,6 @@ protocol_module_base::EVENT_TAG protocol_module_url::handle_sorry_enable(
69977019 protocol_module_base::EVENT_TAG protocol_module_url::handle_sorry_disable(
69987020 const boost::thread::id thread_id)
69997021 {
7000-
70017022 /*-------- DEBUG LOG --------*/
70027023 if (unlikely(LOG_LV_DEBUG == getloglevel())) {
70037024 boost::format formatter("in_function : protocol_module_base::EVENT_TAG protocol_module_url::"
@@ -7252,7 +7273,6 @@ protocol_module_base::EVENT_TAG protocol_module_url::handle_sorry_disable(
72527273 protocol_module_base::EVENT_TAG protocol_module_url::handle_realserver_disconnect(
72537274 const boost::thread::id thread_id, const boost::asio::ip::tcp::endpoint &rs_endpoint)
72547275 {
7255-
72567276 /*-------- DEBUG LOG --------*/
72577277 if (unlikely(LOG_LV_DEBUG == getloglevel())) {
72587278 boost::format formatter("in_function : protocol_module_base::EVENT_TAG protocol_module_url::"
@@ -7430,7 +7450,6 @@ protocol_module_base::EVENT_TAG protocol_module_url::handle_realserver_disconnec
74307450 protocol_module_base::EVENT_TAG protocol_module_url::handle_sorryserver_disconnect(
74317451 const boost::thread::id thread_id, const boost::asio::ip::tcp::endpoint &sorry_endpoint)
74327452 {
7433-
74347453 /*-------- DEBUG LOG --------*/
74357454 if (unlikely(LOG_LV_DEBUG == getloglevel())) {
74367455 boost::format
--- a/l7vsd/module/protocol/protocol_module_url.h
+++ b/l7vsd/module/protocol/protocol_module_url.h
@@ -32,7 +32,7 @@
3232 #include <boost/algorithm/string.hpp>
3333 #include <sstream>
3434 #include <boost/xpressive/xpressive.hpp>
35-#include "../../l7vsd/include/error_code.h"
35+#include "error_code.h"
3636
3737 #ifndef PROTOCOL_MODULE_URL_H
3838 #define PROTOCOL_MODULE_URL_H
Show on old repository browser