OSDN Git Service

git-svn-id: http://10.144.169.20/repos/um/branches/l7vsd-3.x-shamshel@6874 1ed66053...
authoryatabe <yatabe@1ed66053-1c2d-0410-8867-f7571e6e31d3>
Sat, 14 Feb 2009 07:13:55 +0000 (07:13 +0000)
committeryatabe <yatabe@1ed66053-1c2d-0410-8867-f7571e6e31d3>
Sat, 14 Feb 2009 07:13:55 +0000 (07:13 +0000)
module/protocol/protocol_module_cinsert.cpp

index 3eadf99..fbf2a59 100644 (file)
@@ -989,7 +989,7 @@ protocol_module_cinsert::handle_client_recv(
        t_send_status_list_itr                  send_status_itr;
 
        EVENT_TAG       status = STOP;
-std::cout      << "check_point 1" << std::endl;
+
        try
        {
                {
@@ -1002,57 +1002,54 @@ std::cout       << "check_point 1" << std::endl;
                                thread_data = thread_data_itr->second;
                        }
                }
-std::cout      << "check_point 2" << std::endl;
                if( thread_data != NULL )
                {
 
                        if( thread_data->end_flag == END_FLAG_ON )
                        {
                                status = CLIENT_RECV;
-std::cout      << "check_point 3" << std::endl;
                        }
                        else
                        {
-std::cout      << "check_point 4" << std::endl;
                                recive_data_itr = thread_data->recive_data_map.find( thread_data->client_endpoint_tcp );
 
                                if( recive_data_itr != thread_data->recive_data_map.end() )
                                {
-std::cout      << "check_point 5" << std::endl;
+
                                        send_status_itr = recive_data_itr->second.send_status_list.begin();
 
                                        while( send_status_itr != recive_data_itr->second.send_status_list.end())
                                        {
-std::cout      << "check_point 6" << std::endl;
+
                                                if( send_status_itr->status == SEND_END )
                                                {
-std::cout      << "check_point 7" << std::endl;
+
                                                        next_request_offset = send_status_itr->send_offset + send_status_itr->send_end_size;
                                                        send_status_itr = recive_data_itr->second.send_status_list.erase( send_status_itr );
                                                }
                                                else if( send_status_itr->status == SEND_CONTINUE )
                                                {
-std::cout      << "check_point 8" << std::endl;
+
                                                        send_status_itr->send_offset += send_status_itr->send_end_size;
                                                        unsend_data_offset = send_status_itr->send_offset;
                                                        break;
                                                }
                                                else
                                                {
-std::cout      << "check_point 9" << std::endl;
+
                                                        unsend_data_offset = send_status_itr->send_offset;
                                                        unsend_data_size = send_status_itr->unsend_size;
                                                        break;
                                                }
 
                                        }
-std::cout      << "check_point 10" << std::endl;
+
                                        if( recive_data_itr->second.recive_buffer_rest_size < recvlen )
                                        {
-std::cout      << "check_point 11" << std::endl;
+
                                                if( recive_data_itr->second.recive_buffer_max_size < unsend_data_size + recvlen )
                                                {
-std::cout      << "check_point 12" << std::endl;
+
                                                        buffer_1 = new char[unsend_data_size + recvlen];
                                                        buffer_2 = new char[unsend_data_size + recvlen];
 
@@ -1070,7 +1067,7 @@ std::cout << "check_point 12" << std::endl;
                                                        free( recive_data_itr->second.recive_buffer_1 );
                                                        free( recive_data_itr->second.recive_buffer_2 );
 
-                                                       recive_data_itr->second.recive_buffer           = buffer_1;
+                                                       recive_data_itr->second.recive_buffer   = buffer_1;
                                                        recive_data_itr->second.recive_buffer_1 = buffer_1;
                                                        recive_data_itr->second.recive_buffer_2 = buffer_2;
 
@@ -1079,13 +1076,10 @@ std::cout       << "check_point 12" << std::endl;
                                                }
                                                else
                                                {
-std::cout      << "check_point 13" << std::endl;
+
                                                        if( recive_data_itr->second.recive_buffer == recive_data_itr->second.recive_buffer_1 )
                                                        {
-std::cout      << "check_point 14" << std::endl;
-std::cout      << unsend_data_offset << std::endl;
-std::cout      << unsend_data_size << std::endl;
-std::cout      << recvlen << std::endl;
+
                                                                memset( recive_data_itr->second.recive_buffer_2,
                                                                                '\0',
                                                                                recive_data_itr->second.recive_buffer_max_size );
@@ -1103,7 +1097,7 @@ std::cout << recvlen << std::endl;
                                                        }
                                                        else
                                                        {
-std::cout      << "check_point 15" << std::endl;
+
                                                                memset( recive_data_itr->second.recive_buffer_1,
                                                                                '\0',
                                                                                recive_data_itr->second.recive_buffer_max_size );
@@ -1133,7 +1127,7 @@ std::cout << "check_point 15" << std::endl;
 
                                                while( send_status_itr != recive_data_itr->second.send_status_list.end())
                                                {
-std::cout      << "check_point 16" << std::endl;
+
                                                        send_status_itr->send_offset -= unsend_data_offset;
                                                        send_status_itr++;
                                                }
@@ -1141,7 +1135,7 @@ std::cout << "check_point 16" << std::endl;
                                        }
                                        else
                                        {
-std::cout      << "check_point 17" << std::endl;
+
                                                memcpy( recive_data_itr->second.recive_buffer + recive_data_itr->second.recive_buffer_max_size - recive_data_itr->second.recive_buffer_rest_size,
                                                                recvbuffer.data(),
                                                                recvlen );
@@ -1155,13 +1149,13 @@ std::cout       << "check_point 17" << std::endl;
                                        send_status_itr = recive_data_itr->second.send_status_list.begin();
 
                                        rest_request_data_size = recvlen;
-std::cout      << "check_point 18" << std::endl;
+
                                        while( send_status_itr != recive_data_itr->second.send_status_list.end())
                                        {
-std::cout      << "check_point 19" << std::endl;
+
                                                if( send_status_itr->status == SEND_CONTINUE )
                                                {
-std::cout      << "check_point 20" << std::endl;
+
                                                        if( send_status_itr->send_rest_size > rest_request_data_size )
                                                        {
 
@@ -1172,11 +1166,11 @@ std::cout       << "check_point 20" << std::endl;
                                                                send_status_itr->send_end_size = 0;
 
                                                                rest_request_data_size = 0;
-std::cout      << "check_point 21" << std::endl;
+
                                                        }
                                                        else
                                                        {
-std::cout      << "check_point 22" << std::endl;
+
                                                                send_status_itr->send_possible_size = send_status_itr->send_rest_size;
 
                                                                rest_request_data_size -= send_status_itr->send_rest_size;
@@ -1193,11 +1187,11 @@ std::cout       << "check_point 22" << std::endl;
 
                                                        next_request_offset     = send_status_itr->send_offset
                                                                                                + send_status_itr->send_possible_size; 
-std::cout      << "check_point 23" << std::endl;
+
                                                }
                                                else if( send_status_itr->status == SEND_NG )
                                                {
-std::cout      << "check_point 24" << std::endl;
+
                                                        check_result = check_http_method(
                                                                                                (const char*)recive_data_itr->second.recive_buffer
                                                                                                        + send_status_itr->send_offset,
@@ -1205,7 +1199,7 @@ std::cout << "check_point 24" << std::endl;
 
                                                        if( check_result == CHECK_OK )
                                                        {
-std::cout      << "check_point 24-1" << std::endl;
+
                                                                check_result = check_http_version(
                                                                                                        (const char*)recive_data_itr->second.recive_buffer
                                                                                                                + send_status_itr->send_offset,
@@ -1214,7 +1208,7 @@ std::cout << "check_point 24-1" << std::endl;
 
                                                        if( check_result == CHECK_OK )
                                                        {
-std::cout      << "check_point 24-2" << std::endl;
+
                                                                find_result = find_http_header(
                                                                                                (const char*)recive_data_itr->second.recive_buffer
                                                                                                        + send_status_itr->send_offset,
@@ -1225,10 +1219,10 @@ std::cout       << "check_point 24-2" << std::endl;
 
                                                                if( find_result == true )
                                                                {
-std::cout      << "check_point 24-3" << std::endl;
+
                                                                        send_status_itr->send_rest_size
                                                                                                                = http_header_offset + http_header_len + 4;
-std::cout      << send_status_itr->send_rest_size << std::endl;
+
                                                                        find_result = find_http_header(
                                                                                                        (const char*)recive_data_itr->second.recive_buffer
                                                                                                                + send_status_itr->send_offset,
@@ -1239,7 +1233,7 @@ std::cout << send_status_itr->send_rest_size << std::endl;
 
                                                                        if( find_result == true )
                                                                        {
-std::cout      << "check_point 24-4" << std::endl;
+
                                                                                content_length.assign(  recive_data_itr->second.recive_buffer
                                                                                                                                        + send_status_itr->send_offset
                                                                                                                                        + http_header_offset,
@@ -1251,15 +1245,15 @@ std::cout       << "check_point 24-4" << std::endl;
 
                                                                                if( find_result == true )
                                                                                {
-std::cout      << "check_point 24-5" << std::endl;
+
                                                                                        content_length = content_length.substr(
                                                                                                                                                        regex_result.position(1),
                                                                                                                                                        regex_result.length(1));
-std::cout      << content_length << std::endl;
+
                                                                                        send_status_itr->send_rest_size
                                                                                                                                +=      boost::lexical_cast<size_t>(
                                                                                                                                                content_length);
-std::cout      << send_status_itr->send_rest_size << std::endl;
+
                                                                                }
 
                                                                        }
@@ -1269,7 +1263,7 @@ std::cout << send_status_itr->send_rest_size << std::endl;
                                                                }
                                                                else
                                                                {
-std::cout      << "check_point 24-6" << std::endl;
+
                                                                        send_status_itr->unsend_size += rest_request_data_size;
 
                                                                        rest_request_data_size = 0;
@@ -1281,7 +1275,7 @@ std::cout << "check_point 24-6" << std::endl;
                                                        }
                                                        else if( check_result == CHECK_NG )
                                                        {
-std::cout      << "check_point 24-7" << std::endl;
+
                                                                send_status_itr->edit_division = EDIT_DIVISION_NO_EDIT;
 
                                                                send_status_itr->send_rest_size = send_status_itr->unsend_size
@@ -1290,7 +1284,7 @@ std::cout << "check_point 24-7" << std::endl;
                                                        }
                                                        else
                                                        {
-std::cout      << "check_point 24-8" << std::endl;
+
                                                                send_status_itr->unsend_size += rest_request_data_size;
 
                                                                rest_request_data_size = 0;
@@ -1302,7 +1296,7 @@ std::cout << "check_point 24-8" << std::endl;
                                                        if( send_status_itr->send_rest_size >
                                                                        send_status_itr->unsend_size + rest_request_data_size )
                                                        {
-std::cout      << "check_point 24-9" << std::endl;
+
                                                                send_status_itr->send_possible_size
                                                                        = send_status_itr->unsend_size + rest_request_data_size;
 
@@ -1318,7 +1312,7 @@ std::cout << "check_point 24-9" << std::endl;
                                                        }
                                                        else
                                                        {
-std::cout      << "check_point 24-10" << std::endl;
+
                                                                send_status_itr->send_possible_size = send_status_itr->send_rest_size;
 
                                                                rest_request_data_size  = send_status_itr->unsend_size
@@ -1348,12 +1342,9 @@ std::cout        << "check_point 24-10" << std::endl;
                                                send_status_itr++;
 
                                        }
-std::cout      << "check_point 25" << std::endl;
+
                                        while( rest_request_data_size > 0 )
                                        {
-std::cout      << "check_point 26" << std::endl;
-std::cout      << rest_request_data_size << std::endl;
-//                                             send_status_add = new send_status;
 
                                                send_status_add.status                          = SEND_NG;
                                                send_status_add.send_end_size           = 0;
@@ -1370,16 +1361,16 @@ std::cout       << rest_request_data_size << std::endl;
 
                                                if( check_result == CHECK_OK )
                                                {
-std::cout      << "check_point 27" << std::endl;
+
                                                        check_result = check_http_version(
                                                                                                (const char*)recive_data_itr->second.recive_buffer
                                                                                                        + send_status_add.send_offset,
                                                                                                rest_request_data_size );
                                                }
-std::cout      << "check_point 28" << std::endl;
+
                                                if( check_result == CHECK_OK )
                                                {
-std::cout      << "check_point 29" << std::endl;
+
                                                        find_result = find_http_header(
                                                                                        (const char*)recive_data_itr->second.recive_buffer
                                                                                                + send_status_add.send_offset,
@@ -1390,7 +1381,7 @@ std::cout << "check_point 29" << std::endl;
 
                                                        if( find_result == true )
                                                        {
-std::cout      << "check_point 30" << std::endl;
+
                                                                send_status_add.send_rest_size
                                                                                                        = http_header_offset + http_header_len + 4;
 
@@ -1404,7 +1395,7 @@ std::cout << "check_point 30" << std::endl;
 
                                                                if( find_result == true )
                                                                {
-std::cout      << "check_point 31" << std::endl;
+
                                                                        content_length.assign(  recive_data_itr->second.recive_buffer
                                                                                                                                + send_status_add.send_offset
                                                                                                                                + http_header_offset,
@@ -1416,15 +1407,15 @@ std::cout       << "check_point 31" << std::endl;
 
                                                                        if( find_result == true )
                                                                        {
-std::cout      << "check_point 32" << std::endl;
+
                                                                                content_length = content_length.substr(
                                                                                                                                                regex_result.position(1),
                                                                                                                                                regex_result.length(1));
-std::cout      << content_length << std::endl;
+
                                                                                send_status_add.send_rest_size
                                                                                                                        +=      boost::lexical_cast<size_t>(
                                                                                                                                        content_length);
-std::cout      << "check_point 32-1" << std::endl;
+
                                                                        }
 
                                                                }
@@ -1434,7 +1425,7 @@ std::cout << "check_point 32-1" << std::endl;
                                                        }
                                                        else
                                                        {
-std::cout      << "check_point 33" << std::endl;
+
                                                                send_status_add.unsend_size = rest_request_data_size;
 
                                                                rest_request_data_size = 0;
@@ -1448,7 +1439,7 @@ std::cout << "check_point 33" << std::endl;
                                                }
                                                else if( check_result == CHECK_NG )
                                                {
-std::cout      << "check_point 34" << std::endl;
+
                                                        send_status_add.edit_division = EDIT_DIVISION_NO_EDIT;
 
                                                        send_status_add.send_rest_size = rest_request_data_size;
@@ -1456,7 +1447,7 @@ std::cout << "check_point 34" << std::endl;
                                                }
                                                else
                                                {
-std::cout      << "check_point 35" << std::endl;
+
                                                        send_status_add.unsend_size = rest_request_data_size;
 
                                                        rest_request_data_size = 0;
@@ -1466,10 +1457,10 @@ std::cout       << "check_point 35" << std::endl;
                                                        break;
 
                                                }
-std::cout      << "check_point 36" << std::endl;
+
                                                if( send_status_add.send_rest_size > rest_request_data_size )
                                                {
-std::cout      << "check_point 37" << std::endl;
+
                                                        send_status_add.send_possible_size = rest_request_data_size;
 
                                                        send_status_add.send_rest_size -= rest_request_data_size;
@@ -1483,7 +1474,7 @@ std::cout << "check_point 37" << std::endl;
                                                }
                                                else
                                                {
-std::cout      << "check_point 38" << std::endl;
+
                                                        send_status_add.send_possible_size = send_status_add.send_rest_size;
 
                                                        rest_request_data_size -= send_status_add.send_rest_size;
@@ -1508,21 +1499,21 @@ std::cout       << "check_point 38" << std::endl;
                                        send_status_itr = recive_data_itr->second.send_status_list.begin();
 
                                        status = CLIENT_RECV;
-std::cout      << "check_point 39" << std::endl;
+
                                        while( send_status_itr != recive_data_itr->second.send_status_list.end())
                                        {
-std::cout      << "check_point 40" << std::endl;
+
                                                if( send_status_itr->status == SEND_OK )
                                                {
-std::cout      << "check_point 41" << std::endl;
+
                                                        if( thread_data->sorry_flag == SORRY_FLAG_ON )
                                                        {
-std::cout      << "check_point 42" << std::endl;
+
                                                                status = SORRYSERVER_SELECT;
                                                        }
                                                        else
                                                        {
-std::cout      << "check_point 43" << std::endl;
+
                                                                status = REALSERVER_SELECT;
                                                        }
 
@@ -1539,10 +1530,10 @@ std::cout       << "check_point 43" << std::endl;
                }
        } catch (const std::exception& ex)
        {
-std::cout      << "check_point 32-2" << std::endl;
+
        } catch (...)
        {
-std::cout      << "check_point 32-3" << std::endl;
+
        }
        return  status;
 }
@@ -2834,27 +2825,26 @@ protocol_module_cinsert::handle_realserver_recv(
 
        t_session_thread_data_cinsert   thread_data;
 
-       recive_data             realserver_recv_data;
-
-       send_status*                                    send_status_add         = NULL;
+       char*   buffer                          = NULL;
+       char*   buffer_1                        = NULL;
+       char*   buffer_2                        = NULL;
 
        size_t  unsend_data_offset              = 0;
        size_t  unsend_data_size                = 0;
        size_t  rest_response_data_size = 0;
        size_t  next_response_offset    = 0;
 
-       char*   buffer                          = NULL;
-       char*   buffer_1                        = NULL;
-       char*   buffer_2                        = NULL;
+       send_status                     send_status_add;
+
+       recive_data             realserver_recv_data;
 
-       bool                            find_result     = false;
        CHECK_RESULT_TAG        check_result;
+       bool                            find_result     = false;
        size_t                          http_header_offset      = 0;
        size_t                          http_header_len         = 0;
-
-       std::string             http_header_name_blank                  = "";
-       std::string             http_header_name_content_length = "Content-Length";
-       std::string             content_length;
+       std::string                     http_header_name_blank                  = "";
+       std::string                     http_header_name_content_length = "Content-Length";
+       std::string                     content_length;
        match_results< const char* >    regex_result;
        cregex  content_length_regex = icase("Content-Length") >> ":" >> *~_d >> (s1 = +_d) >> *~_d;
 
@@ -2912,6 +2902,7 @@ protocol_module_cinsert::handle_realserver_recv(
 
                                        if( send_status_itr->status == SEND_END )
                                        {
+                                               next_response_offset = send_status_itr->send_offset + send_status_itr->send_end_size;
                                                send_status_itr = recive_data_itr->second.send_status_list.erase( send_status_itr );
                                        }
                                        else if( send_status_itr->status == SEND_CONTINUE )
@@ -2928,6 +2919,8 @@ protocol_module_cinsert::handle_realserver_recv(
                                                break;
                                        }
 
+                                       send_status_itr++;
+
                                }
 
                                if( recive_data_itr->second.recive_buffer_rest_size < recvlen )
@@ -2952,7 +2945,7 @@ protocol_module_cinsert::handle_realserver_recv(
                                                free( recive_data_itr->second.recive_buffer_1 );
                                                free( recive_data_itr->second.recive_buffer_2 );
 
-                                               recive_data_itr->second.recive_buffer           = buffer_1;
+                                               recive_data_itr->second.recive_buffer   = buffer_1;
                                                recive_data_itr->second.recive_buffer_1 = buffer_1;
                                                recive_data_itr->second.recive_buffer_2 = buffer_2;
 
@@ -3000,6 +2993,8 @@ protocol_module_cinsert::handle_realserver_recv(
                                        recive_data_itr->second.recive_buffer_rest_size
                                                = recive_data_itr->second.recive_buffer_max_size - unsend_data_size - recvlen;
 
+                                       next_response_offset = 0;
+
                                        unsend_data_size += recvlen;
 
                                        send_status_itr = recive_data_itr->second.send_status_list.begin();
@@ -3008,6 +3003,7 @@ protocol_module_cinsert::handle_realserver_recv(
                                        {
 
                                                send_status_itr->send_offset -= unsend_data_offset;
+                                               send_status_itr++;
 
                                        }
 
@@ -3130,9 +3126,7 @@ protocol_module_cinsert::handle_realserver_recv(
 
                                                                                send_status_itr->send_rest_size
                                                                                                                        +=      boost::lexical_cast<size_t>(
-                                                                                                                                       content_length.substr(
-                                                                                                                                               regex_result.position(1),
-                                                                                                                                               regex_result.length(1)));
+                                                                                                                                       content_length);
 
                                                                        }
 
@@ -3226,22 +3220,24 @@ protocol_module_cinsert::handle_realserver_recv(
                                while( rest_response_data_size > 0 )
                                {
 
-                                       send_status_add = new send_status;
-
-                                       send_status_add->status = SEND_NG;
-
-                                       send_status_add->send_offset = next_response_offset;
+                                       send_status_add.status                          = SEND_NG;
+                                       send_status_add.send_end_size           = 0;
+                                       send_status_add.send_rest_size          = 0;
+                                       send_status_add.send_possible_size      = 0;
+                                       send_status_add.unsend_size                     = 0;
+                                       send_status_add.edit_division           = 0;
+                                       send_status_add.send_offset                     = next_response_offset;
 
                                        check_result = check_http_method(
                                                                                (const char*)recive_data_itr->second.recive_buffer
-                                                                                       + send_status_add->send_offset,
+                                                                                       + send_status_add.send_offset,
                                                                                rest_response_data_size );
 
                                        if( check_result == CHECK_OK )
                                        {
                                                check_result = check_http_version(
                                                                                        (const char*)recive_data_itr->second.recive_buffer
-                                                                                               + send_status_add->send_offset,
+                                                                                               + send_status_add.send_offset,
                                                                                        rest_response_data_size );
                                        }
 
@@ -3250,7 +3246,7 @@ protocol_module_cinsert::handle_realserver_recv(
 
                                                find_result = find_http_header(
                                                                                (const char*)recive_data_itr->second.recive_buffer
-                                                                                       + send_status_add->send_offset,
+                                                                                       + send_status_add.send_offset,
                                                                                rest_response_data_size,
                                                                                http_header_name_blank,
                                                                                http_header_offset,
@@ -3259,13 +3255,13 @@ protocol_module_cinsert::handle_realserver_recv(
                                                if( find_result == true )
                                                {
 
-                                                       send_status_add->send_rest_size
+                                                       send_status_add.send_rest_size
                                                                                                = http_header_offset + http_header_len + 4;
 
                                                        find_result = find_http_header(
                                                                                        (const char*)recive_data_itr->second.recive_buffer
-                                                                                               + send_status_add->send_offset,
-                                                                                       send_status_add->send_rest_size,
+                                                                                               + send_status_add.send_offset,
+                                                                                       send_status_add.send_rest_size,
                                                                                        http_header_name_content_length,
                                                                                        http_header_offset,
                                                                                        http_header_len );
@@ -3274,7 +3270,7 @@ protocol_module_cinsert::handle_realserver_recv(
                                                        {
 
                                                                content_length.assign(  recive_data_itr->second.recive_buffer
-                                                                                                                       + send_status_add->send_offset
+                                                                                                                       + send_status_add.send_offset
                                                                                                                        + http_header_offset,
                                                                                                                http_header_len );
 
@@ -3289,23 +3285,21 @@ protocol_module_cinsert::handle_realserver_recv(
                                                                                                                                        regex_result.position(1),
                                                                                                                                        regex_result.length(1));
 
-                                                                       send_status_add->send_rest_size
+                                                                       send_status_add.send_rest_size
                                                                                                                +=      boost::lexical_cast<size_t>(
-                                                                                                                               content_length.substr(
-                                                                                                                                       regex_result.position(1),
-                                                                                                                                       regex_result.length(1)));
+                                                                                                                               content_length);
 
                                                                }
 
                                                        }
 
-                                                       send_status_add->edit_division = EDIT_DIVISION_EDIT;
+                                                       send_status_add.edit_division = EDIT_DIVISION_EDIT;
 
                                                }
                                                else
                                                {
 
-                                                       send_status_add->unsend_size = rest_response_data_size;
+                                                       send_status_add.unsend_size = rest_response_data_size;
 
                                                        rest_response_data_size = 0;
 
@@ -3317,15 +3311,15 @@ protocol_module_cinsert::handle_realserver_recv(
                                        else if( check_result == CHECK_NG )
                                        {
 
-                                               send_status_add->edit_division = EDIT_DIVISION_NO_EDIT;
+                                               send_status_add.edit_division = EDIT_DIVISION_NO_EDIT;
 
-                                               send_status_add->send_rest_size = rest_response_data_size;
+                                               send_status_add.send_rest_size = rest_response_data_size;
 
                                        }
                                        else
                                        {
 
-                                               send_status_add->unsend_size = rest_response_data_size;
+                                               send_status_add.unsend_size = rest_response_data_size;
 
                                                rest_response_data_size = 0;
 
@@ -3333,16 +3327,16 @@ protocol_module_cinsert::handle_realserver_recv(
 
                                        }
 
-                                       if( send_status_add->send_rest_size > rest_response_data_size )
+                                       if( send_status_add.send_rest_size > rest_response_data_size )
                                        {
 
-                                               send_status_add->send_possible_size = rest_response_data_size;
+                                               send_status_add.send_possible_size = rest_response_data_size;
 
-                                               send_status_add->send_rest_size -= rest_response_data_size;
+                                               send_status_add.send_rest_size -= rest_response_data_size;
 
-                                               send_status_add->send_end_size = 0;
+                                               send_status_add.send_end_size = 0;
 
-                                               send_status_add->unsend_size = 0;
+                                               send_status_add.unsend_size = 0;
 
                                                rest_response_data_size = 0;
 
@@ -3350,22 +3344,22 @@ protocol_module_cinsert::handle_realserver_recv(
                                        else
                                        {
 
-                                               send_status_add->send_possible_size = send_status_add->send_rest_size;
+                                               send_status_add.send_possible_size = send_status_add.send_rest_size;
 
-                                               rest_response_data_size -= send_status_itr->send_rest_size;
+                                               rest_response_data_size -= send_status_add.send_rest_size;
 
-                                               send_status_add->send_rest_size = 0;
+                                               send_status_add.send_rest_size = 0;
 
-                                               send_status_add->send_end_size = 0;
+                                               send_status_add.send_end_size = 0;
 
-                                               send_status_add->unsend_size = 0;
+                                               send_status_add.unsend_size = 0;
 
                                        }
 
-                                       send_status_itr->status = SEND_OK;
+                                       send_status_add.status = SEND_OK;
 
-                                       next_response_offset    = send_status_itr->send_offset
-                                                                                       + send_status_itr->send_possible_size;
+                                       next_response_offset    = send_status_add.send_offset
+                                                                                       + send_status_add.send_possible_size;
 
                                }
 
@@ -3382,6 +3376,8 @@ protocol_module_cinsert::handle_realserver_recv(
                                                break;
                                        }
 
+                                       send_status_itr++;
+
                                }
 
                        }
@@ -3420,7 +3416,7 @@ protocol_module_cinsert::handle_sorryserver_recv(
 
        recive_data             sorryserver_recv_data;
 
-       send_status*    send_status_add         = NULL;
+       send_status             send_status_add;
 
        size_t  unsend_data_offset              = 0;
        size_t  unsend_data_size                = 0;
@@ -3494,6 +3490,8 @@ protocol_module_cinsert::handle_sorryserver_recv(
 
                                        if( send_status_itr->status == SEND_END )
                                        {
+
+                                               next_response_offset = send_status_itr->send_offset + send_status_itr->send_end_size;
                                                send_status_itr = recive_data_itr->second.send_status_list.erase( send_status_itr );
                                        }
                                        else if( send_status_itr->status == SEND_CONTINUE )
@@ -3510,6 +3508,8 @@ protocol_module_cinsert::handle_sorryserver_recv(
                                                break;
                                        }
 
+                                       send_status_itr++;
+
                                }
 
                                if( recive_data_itr->second.recive_buffer_rest_size < recvlen )
@@ -3590,6 +3590,7 @@ protocol_module_cinsert::handle_sorryserver_recv(
                                        {
 
                                                send_status_itr->send_offset -= unsend_data_offset;
+                                               send_status_itr++;
 
                                        }
 
@@ -3712,9 +3713,7 @@ protocol_module_cinsert::handle_sorryserver_recv(
 
                                                                                send_status_itr->send_rest_size
                                                                                                                        +=      boost::lexical_cast<size_t>(
-                                                                                                                                       content_length.substr(
-                                                                                                                                               regex_result.position(1),
-                                                                                                                                               regex_result.length(1)));
+                                                                                                                                       content_length);
 
                                                                        }
 
@@ -3808,22 +3807,24 @@ protocol_module_cinsert::handle_sorryserver_recv(
                                while( rest_response_data_size > 0 )
                                {
 
-                                       send_status_add = new send_status;
-
-                                       send_status_add->status = SEND_NG;
-
-                                       send_status_add->send_offset = next_response_offset;
+                                       send_status_add.status                          = SEND_NG;
+                                       send_status_add.send_end_size           = 0;
+                                       send_status_add.send_rest_size          = 0;
+                                       send_status_add.send_possible_size      = 0;
+                                       send_status_add.unsend_size                     = 0;
+                                       send_status_add.edit_division           = 0;
+                                       send_status_add.send_offset                     = next_response_offset;
 
                                        check_result = check_http_method(
                                                                                (const char*)recive_data_itr->second.recive_buffer
-                                                                                       + send_status_add->send_offset,
+                                                                                       + send_status_add.send_offset,
                                                                                rest_response_data_size );
 
                                        if( check_result == CHECK_OK )
                                        {
                                                check_result = check_http_version(
                                                                                        (const char*)recive_data_itr->second.recive_buffer
-                                                                                               + send_status_add->send_offset,
+                                                                                               + send_status_add.send_offset,
                                                                                        rest_response_data_size );
                                        }
 
@@ -3832,7 +3833,7 @@ protocol_module_cinsert::handle_sorryserver_recv(
 
                                                find_result = find_http_header(
                                                                                (const char*)recive_data_itr->second.recive_buffer
-                                                                                       + send_status_add->send_offset,
+                                                                                       + send_status_add.send_offset,
                                                                                rest_response_data_size,
                                                                                http_header_name_blank,
                                                                                http_header_offset,
@@ -3841,13 +3842,13 @@ protocol_module_cinsert::handle_sorryserver_recv(
                                                if( find_result == true )
                                                {
 
-                                                       send_status_add->send_rest_size
+                                                       send_status_add.send_rest_size
                                                                                                = http_header_offset + http_header_len + 4;
 
                                                        find_result = find_http_header(
                                                                                        (const char*)recive_data_itr->second.recive_buffer
-                                                                                               + send_status_add->send_offset,
-                                                                                       send_status_add->send_rest_size,
+                                                                                               + send_status_add.send_offset,
+                                                                                       send_status_add.send_rest_size,
                                                                                        http_header_name_content_length,
                                                                                        http_header_offset,
                                                                                        http_header_len );
@@ -3856,7 +3857,7 @@ protocol_module_cinsert::handle_sorryserver_recv(
                                                        {
 
                                                                content_length.assign(  recive_data_itr->second.recive_buffer
-                                                                                                                       + send_status_add->send_offset
+                                                                                                                       + send_status_add.send_offset
                                                                                                                        + http_header_offset,
                                                                                                                http_header_len );
 
@@ -3871,23 +3872,21 @@ protocol_module_cinsert::handle_sorryserver_recv(
                                                                                                                                        regex_result.position(1),
                                                                                                                                        regex_result.length(1));
 
-                                                                       send_status_add->send_rest_size
+                                                                       send_status_add.send_rest_size
                                                                                                                +=      boost::lexical_cast<size_t>(
-                                                                                                                               content_length.substr(
-                                                                                                                                       regex_result.position(1),
-                                                                                                                                       regex_result.length(1)));
+                                                                                                                               content_length);
 
                                                                }
 
                                                        }
 
-                                                       send_status_add->edit_division = EDIT_DIVISION_NO_EDIT;
+                                                       send_status_add.edit_division = EDIT_DIVISION_NO_EDIT;
 
                                                }
                                                else
                                                {
 
-                                                       send_status_add->unsend_size = rest_response_data_size;
+                                                       send_status_add.unsend_size = rest_response_data_size;
 
                                                        rest_response_data_size = 0;
 
@@ -3899,15 +3898,15 @@ protocol_module_cinsert::handle_sorryserver_recv(
                                        else if( check_result == CHECK_NG )
                                        {
 
-                                               send_status_add->edit_division = EDIT_DIVISION_NO_EDIT;
+                                               send_status_add.edit_division = EDIT_DIVISION_NO_EDIT;
 
-                                               send_status_add->send_rest_size = rest_response_data_size;
+                                               send_status_add.send_rest_size = rest_response_data_size;
 
                                        }
                                        else
                                        {
 
-                                               send_status_add->unsend_size = rest_response_data_size;
+                                               send_status_add.unsend_size = rest_response_data_size;
 
                                                rest_response_data_size = 0;
 
@@ -3915,16 +3914,16 @@ protocol_module_cinsert::handle_sorryserver_recv(
 
                                        }
 
-                                       if( send_status_add->send_rest_size > rest_response_data_size )
+                                       if( send_status_add.send_rest_size > rest_response_data_size )
                                        {
 
-                                               send_status_add->send_possible_size = rest_response_data_size;
+                                               send_status_add.send_possible_size = rest_response_data_size;
 
-                                               send_status_add->send_rest_size -= rest_response_data_size;
+                                               send_status_add.send_rest_size -= rest_response_data_size;
 
-                                               send_status_add->send_end_size = 0;
+                                               send_status_add.send_end_size = 0;
 
-                                               send_status_add->unsend_size = 0;
+                                               send_status_add.unsend_size = 0;
 
                                                rest_response_data_size = 0;
 
@@ -3932,22 +3931,22 @@ protocol_module_cinsert::handle_sorryserver_recv(
                                        else
                                        {
 
-                                               send_status_add->send_possible_size = send_status_add->send_rest_size;
+                                               send_status_add.send_possible_size = send_status_add.send_rest_size;
 
-                                               rest_response_data_size -= send_status_itr->send_rest_size;
+                                               rest_response_data_size -= send_status_add.send_rest_size;
 
-                                               send_status_add->send_rest_size = 0;
+                                               send_status_add.send_rest_size = 0;
 
-                                               send_status_add->send_end_size = 0;
+                                               send_status_add.send_end_size = 0;
 
-                                               send_status_add->unsend_size = 0;
+                                               send_status_add.unsend_size = 0;
 
                                        }
 
-                                       send_status_itr->status = SEND_OK;
+                                       send_status_add.status = SEND_OK;
 
-                                       next_response_offset    = send_status_itr->send_offset
-                                                                                       + send_status_itr->send_possible_size;
+                                       next_response_offset    = send_status_add.send_offset
+                                                                                       + send_status_add.send_possible_size;
 
                                }
 
@@ -3964,6 +3963,8 @@ protocol_module_cinsert::handle_sorryserver_recv(
                                                break;
                                        }
 
+                                       send_status_itr++;
+
                                }
 
                        }
@@ -4414,6 +4415,8 @@ protocol_module_cinsert::handle_client_send( const boost::thread::id thread_id )
        
                                                        edit_data_itr->insert_position -= send_status_itr->send_end_size;
        
+                                                       edit_data_itr++;
+
                                                }
        
                                                send_status_itr->send_end_size = 0;
@@ -5013,6 +5016,8 @@ protocol_module_cinsert::handle_realserver_disconnect(
                                                break;
                                        }
 
+                                       recive_data_itr++;
+
                                }
 
                        }
@@ -5136,6 +5141,8 @@ protocol_module_cinsert::handle_sorryserver_disconnect(
                                                break;
                                        }
 
+                                       recive_data_itr++;
+
                                }
 
                        }