Defines | Functions | Variables

HttpSM.cc File Reference

HTTP state machine. More...

#include "HttpSM.h"
#include "ProxyConfig.h"
#include "HttpClientSession.h"
#include "HttpServerSession.h"
#include "HttpDebugNames.h"
#include "HttpSessionManager.h"
#include "P_Cache.h"
#include "P_Net.h"
#include "StatPages.h"
#include "Log.h"
#include "LogAccessHttp.h"
#include "ICP.h"
#include "PluginVC.h"
#include "ReverseProxy.h"
#include "RemapProcessor.h"
#include "Transform.h"
#include "HttpPages.h"
#include "congest/Congestion.h"
Include dependency graph for HttpSM.cc:

Go to the source code of this file.

Defines

#define DEFAULT_RESPONSE_BUFFER_SIZE_INDEX   6
#define DEFAULT_REQUEST_BUFFER_SIZE_INDEX   6
#define MIN_CONFIG_BUFFER_SIZE_INDEX   5
#define hsm_release_assert(EX)
#define USE_NEW_EMPTY_MIOBUFFER
#define MAX_SCATTER_LEN   (sizeof(HttpSM)/sizeof(uint32_t) + 1)
#define HTTP_INCREMENT_TRANS_STAT(X)   HttpTransact::update_stat(&t_state, X, 1);
#define REMEMBER_EVENT_FILTER(e)   1
#define __REMEMBER(x)   #x
#define _REMEMBER(x)   __REMEMBER(x)
#define RECORD_FILE_LINE()   history[pos].fileline = __FILE__ ":" _REMEMBER (__LINE__);
#define REMEMBER(e, r)
#define DebugSM(tag,...)   DebugSpecific(debug_on, tag, __VA_ARGS__)
#define STATE_ENTER(state_name, event)
#define HTTP_SM_SET_DEFAULT_HANDLER(_h)

Functions

static double milestone_difference (const ink_hrtime start, const ink_hrtime end)
 Takes two milestones and returns the difference.
static double milestone_difference_msec (const ink_hrtime start, const ink_hrtime end)
void clear_http_handler_times ()

Variables

DLL< HttpSMdebug_sm_list
ink_mutex debug_sm_list_mutex
static uint32_t val [MAX_SCATTER_LEN]
static uint16_t to [MAX_SCATTER_LEN]
static int scat_count = 0
static const int sub_header_size = sizeof("Content-type: ") - 1 + 2 + sizeof("Content-range: bytes ") - 1 + 4
static const int boundary_size = 2 + sizeof("RANGE_SEPARATOR") - 1 + 2
static const char * str_100_continue_response = "HTTP/1.1 100 Continue\r\n\r\n"
static const int len_100_continue_response = strlen(str_100_continue_response)
SparseClassAllocator< HttpSMhttpSMAllocator ("httpSMAllocator", 128, 16, HttpSM::_instantiate_func)
static int next_sm_id = 0

Detailed Description

HTTP state machine.

License

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file HttpSM.cc.


Define Documentation

#define __REMEMBER (   x  )     #x

Definition at line 276 of file HttpSM.cc.

#define _REMEMBER (   x  )     __REMEMBER(x)

Definition at line 277 of file HttpSM.cc.

#define DebugSM (   tag,
  ... 
)    DebugSpecific(debug_on, tag, __VA_ARGS__)

Definition at line 286 of file HttpSM.cc.

Referenced by HttpSM::attach_server_session(), HttpSM::call_transact_and_set_next_state(), HttpSM::do_cache_delete_all_alts(), HttpSM::do_cache_lookup_and_read(), HttpSM::do_cache_prepare_action(), HttpSM::do_hostdb_lookup(), HttpSM::do_hostdb_reverse_lookup(), HttpSM::do_hostdb_update_if_necessary(), HttpSM::do_http_server_open(), HttpSM::do_redirect(), HttpSM::do_remap_request(), HttpSM::handle_server_setup_error(), HttpSM::is_bg_fill_necessary(), HttpSM::is_http_server_eos_truncation(), HttpSM::is_redirect_required(), HttpSM::kill_this(), HttpSM::main_handler(), HttpSM::mark_host_failure(), HttpSM::perform_cache_write_action(), HttpSM::perform_transform_cache_write_action(), HttpSM::process_hostdb_info(), HttpSM::process_srv_info(), HttpSM::redirect_request(), HttpSM::set_next_state(), HttpSM::setup_error_transfer(), HttpSM::setup_server_send_request(), HttpSM::setup_server_transfer(), HttpSM::state_api_callout(), HttpSM::state_cache_open_read(), HttpSM::state_hostdb_reverse_lookup(), HttpSM::state_http_server_open(), HttpSM::state_icp_lookup(), HttpSM::state_read_client_request_header(), HttpSM::state_read_push_response_header(), HttpSM::state_read_server_response_header(), HttpSM::state_remap_request(), HttpSM::state_send_server_request_header(), HttpSM::state_watch_for_client_abort(), HttpSM::tunnel_handler_100_continue(), HttpSM::tunnel_handler_cache_write(), HttpSM::tunnel_handler_post_ua(), HttpSM::tunnel_handler_server(), HttpSM::tunnel_handler_ua(), and HttpSM::update_stats().

#define DEFAULT_REQUEST_BUFFER_SIZE_INDEX   6

Definition at line 49 of file HttpSM.cc.

#define DEFAULT_RESPONSE_BUFFER_SIZE_INDEX   6

Definition at line 48 of file HttpSM.cc.

#define hsm_release_assert (   EX  ) 
Value:
{ \
      if (!(EX)) \
      { \
         this->dump_state_on_assert(); \
         _ink_assert(#EX, __FILE__, __LINE__); \
      } \
}

Definition at line 52 of file HttpSM.cc.

Referenced by HttpSM::attach_server_session(), HttpSM::do_http_server_open(), HttpSM::setup_server_send_request(), and HttpSM::tunnel_handler_post_ua().

#define HTTP_INCREMENT_TRANS_STAT (   X  )     HttpTransact::update_stat(&t_state, X, 1);
#define HTTP_SM_SET_DEFAULT_HANDLER (   _h  ) 
#define MAX_SCATTER_LEN   (sizeof(HttpSM)/sizeof(uint32_t) + 1)

Definition at line 86 of file HttpSM.cc.

#define MIN_CONFIG_BUFFER_SIZE_INDEX   5

Definition at line 50 of file HttpSM.cc.

#define RECORD_FILE_LINE (  )     history[pos].fileline = __FILE__ ":" _REMEMBER (__LINE__);

Definition at line 279 of file HttpSM.cc.

#define REMEMBER (   e,
  r 
)
Value:
{ if (REMEMBER_EVENT_FILTER(e)) { \
    add_history_entry(__FILE__ ":" _REMEMBER (__LINE__), e, r); }}

Definition at line 282 of file HttpSM.cc.

Referenced by HttpSM::do_cache_lookup_and_read().

#define REMEMBER_EVENT_FILTER (   e  )     1

Definition at line 274 of file HttpSM.cc.

#define STATE_ENTER (   state_name,
  event 
)
Value:
{ \
    /*ink_assert (magic == HTTP_SM_MAGIC_ALIVE); */ REMEMBER (event, reentrancy_count);  \
        DebugSM("http", "[%" PRId64 "] [%s, %s]", sm_id, \
        #state_name, HttpDebugNames::get_event_name(event)); }

Definition at line 291 of file HttpSM.cc.

Referenced by HttpSM::handle_post_failure(), HttpSM::handle_server_setup_error(), HttpSM::state_add_to_list(), HttpSM::state_api_callback(), HttpSM::state_api_callout(), HttpSM::state_cache_open_read(), HttpSM::state_cache_open_write(), HttpSM::state_common_wait_for_transform_read(), HttpSM::state_congestion_control_lookup(), HttpSM::state_handle_stat_page(), HttpSM::state_hostdb_lookup(), HttpSM::state_hostdb_reverse_lookup(), HttpSM::state_http_server_open(), HttpSM::state_icp_lookup(), HttpSM::state_raw_http_server_open(), HttpSM::state_read_client_request_header(), HttpSM::state_read_push_response_header(), HttpSM::state_read_server_response_header(), HttpSM::state_remap_request(), HttpSM::state_remove_from_list(), HttpSM::state_request_wait_for_transform_read(), HttpSM::state_response_wait_for_transform_read(), HttpSM::state_send_server_request_header(), HttpSM::state_srv_lookup(), HttpSM::state_watch_for_client_abort(), HttpSM::tunnel_handler(), HttpSM::tunnel_handler_100_continue(), HttpSM::tunnel_handler_100_continue_ua(), HttpSM::tunnel_handler_cache_fill(), HttpSM::tunnel_handler_cache_read(), HttpSM::tunnel_handler_cache_write(), HttpSM::tunnel_handler_for_partial_post(), HttpSM::tunnel_handler_plugin_agent(), HttpSM::tunnel_handler_post(), HttpSM::tunnel_handler_post_server(), HttpSM::tunnel_handler_post_ua(), HttpSM::tunnel_handler_push(), HttpSM::tunnel_handler_server(), HttpSM::tunnel_handler_ssl_consumer(), HttpSM::tunnel_handler_ssl_producer(), HttpSM::tunnel_handler_transform_read(), HttpSM::tunnel_handler_transform_write(), HttpSM::tunnel_handler_ua(), and HttpSM::tunnel_handler_ua_push().

#define USE_NEW_EMPTY_MIOBUFFER

Definition at line 66 of file HttpSM.cc.


Function Documentation

void clear_http_handler_times (  ) 

Definition at line 7306 of file HttpSM.cc.

Referenced by initialize_all_global_stats().

static double milestone_difference ( const ink_hrtime  start,
const ink_hrtime  end 
) [static]

Takes two milestones and returns the difference.

Parameters:
start The start time
end The end time
Returns:
A double that is the time in seconds

Definition at line 104 of file HttpSM.cc.

Referenced by HttpSM::update_stats().

static double milestone_difference_msec ( const ink_hrtime  start,
const ink_hrtime  end 
) [static]

Definition at line 113 of file HttpSM.cc.

Referenced by HttpSM::process_hostdb_info().


Variable Documentation

const int boundary_size = 2 + sizeof("RANGE_SEPARATOR") - 1 + 2 [static]

Definition at line 92 of file HttpSM.cc.

Definition at line 70 of file HttpSM.cc.

Definition at line 71 of file HttpSM.cc.

Referenced by HttpSM::init(), init_HttpProxyServer(), and HttpSM::kill_this().

SparseClassAllocator<HttpSM> httpSMAllocator("httpSMAllocator", 128, 16, HttpSM::_instantiate_func)

Definition at line 95 of file HttpSM.cc.

int next_sm_id = 0 [static]

Definition at line 302 of file HttpSM.cc.

int scat_count = 0 [static]

Definition at line 89 of file HttpSM.cc.

Referenced by HttpSM::_instantiate_func(), and HttpSM::_make_scatter_list().

const char* str_100_continue_response = "HTTP/1.1 100 Continue\r\n\r\n" [static]

Definition at line 94 of file HttpSM.cc.

const int sub_header_size = sizeof("Content-type: ") - 1 + 2 + sizeof("Content-range: bytes ") - 1 + 4 [static]

Definition at line 91 of file HttpSM.cc.

Referenced by HttpSM::calculate_output_cl().

uint16_t to[MAX_SCATTER_LEN] [static]
uint32_t val[MAX_SCATTER_LEN] [static]

Definition at line 87 of file HttpSM.cc.

Referenced by HttpSM::_instantiate_func(), HttpSM::_make_scatter_list(), TransformTerminus::handle_event(), INKContInternal::handle_event_count(), HttpTransact::handle_upgrade_request(), http_parse_qvalue(), http_parse_te(), ParentRecord::Init(), LogFieldAliasTable::init(), CongestionControlRecord::Init(), CacheHostRecord::Init(), CacheControlRecord::Init(), ink_atoi(), ink_atoui(), is_header_keep_alive(), LogObject::log(), LogAccessHttp::marshal_cache_resp_content_len(), LogAccessHttp::marshal_cache_resp_header_len(), LogAccessTest::marshal_cache_result_code(), LogAccessTest::marshal_client_finish_status_code(), LogAccessTest::marshal_client_req_body_len(), LogAccessTest::marshal_client_req_header_len(), LogAccessTest::marshal_client_req_http_method(), LogAccessTest::marshal_client_req_http_version(), LogAccess::marshal_config_int_var(), LogAccess::marshal_entry_type(), LogAccessTest::marshal_proxy_finish_status_code(), LogAccessTest::marshal_proxy_hierarchy_route(), LogAccessTest::marshal_proxy_req_body_len(), LogAccessHttp::marshal_proxy_req_body_len(), LogAccessTest::marshal_proxy_req_header_len(), LogAccessHttp::marshal_proxy_req_header_len(), LogAccessTest::marshal_proxy_resp_content_len(), LogAccessICP::marshal_proxy_resp_content_len(), LogAccessHttp::marshal_proxy_resp_content_len(), LogAccessTest::marshal_proxy_resp_header_len(), LogAccessHttp::marshal_proxy_resp_header_len(), LogAccessTest::marshal_proxy_resp_squid_len(), LogAccessICP::marshal_proxy_resp_squid_len(), LogAccessHttp::marshal_proxy_resp_squid_len(), LogAccessTest::marshal_proxy_resp_status_code(), LogAccess::marshal_record(), LogAccessTest::marshal_server_resp_content_len(), LogAccessHttp::marshal_server_resp_content_len(), LogAccessTest::marshal_server_resp_header_len(), LogAccessHttp::marshal_server_resp_header_len(), LogAccessTest::marshal_server_resp_status_code(), LogAccessTest::marshal_transfer_time_ms(), LogAccessICP::marshal_transfer_time_ms(), LogAccessHttp::marshal_transfer_time_ms(), LogAccessICP::marshal_transfer_time_s(), LogAccessHttp::marshal_transfer_time_s(), mime_parse_integer(), mime_parse_year(), HTTPInfo::object_key_get(), HTTPInfo::object_size_get(), Lockfile::Open(), CommandLineArgs::parse_arguments(), parseConfigLine(), LogConfig::read_configuration_variables(), ClusterControl::real_alloc_data(), RecDataAdd(), RecDataDiv(), RecDataMul(), RecDataSub(), NetVConnection::set_is_internal_request(), UnixNetVConnection::set_tcp_init_cwnd(), LogAccess::unmarshal_http_status(), LogAccess::unmarshal_int(), LogAccess::unmarshal_int_to_str(), LogAccess::unmarshal_int_to_str_hex(), and LogAccess::unmarshal_ttmsf().