#include <FetchSM.h>
Inherits Continuation.
Public Member Functions | |
FetchSM () | |
void | init_comm () |
void | init (Continuation *cont, TSFetchWakeUpOptions options, TSFetchEvent events, const char *headers, int length, sockaddr const *addr) |
int | fetch_handler (int event, void *data) |
void | process_fetch_read (int event) |
void | process_fetch_write (int event) |
void | httpConnect () |
void | cleanUp () |
void | get_info_from_buffer (IOBufferReader *reader) |
char * | resp_get (int *length) |
TSMBuffer | resp_hdr_bufp () |
TSMLoc | resp_hdr_mloc () |
void | ext_init (Continuation *cont, const char *method, const char *url, const char *version, const sockaddr *client_addr, int flags) |
void | ext_add_header (const char *name, int name_len, const char *value, int value_len) |
void | ext_lanuch () |
void | ext_destroy () |
ssize_t | ext_read_data (char *buf, size_t len) |
void | ext_write_data (const void *data, size_t len) |
void | ext_set_user_data (void *data) |
void * | ext_get_user_data () |
bool | get_internal_request () |
void | set_internal_request (bool val) |
Definition at line 40 of file FetchSM.h.
void FetchSM::cleanUp | ( | void | ) |
Definition at line 35 of file FetchSM.cc.
References __FUNCTION__, ats_free(), Ptr< T >::clear(), ChunkedHandler::clear(), Debug, DEBUG_TAG, HdrHeapSDKHandle::destroy(), PluginVC::do_io_close(), FetchSMAllocator, free_MIOBuffer(), http_parser_clear(), Continuation::mutex, and TS_FETCH_FLAGS_DECHUNK.
Referenced by ext_destroy(), fetch_handler(), process_fetch_read(), and process_fetch_write().
void FetchSM::ext_add_header | ( | const char * | name, | |
int | name_len, | |||
const char * | value, | |||
int | value_len | |||
) |
Definition at line 512 of file FetchSM.cc.
References TS_MIME_FIELD_CONTENT_LENGTH, TS_MIME_LEN_CONTENT_LENGTH, and MIOBuffer::write().
void FetchSM::ext_destroy | ( | ) |
Definition at line 600 of file FetchSM.cc.
References cleanUp(), eventProcessor, FETCH_LOCK_RETRY_TIME, Continuation::mutex, MUTEX_TRY_LOCK, EventProcessor::schedule_in(), and this_ethread().
void * FetchSM::ext_get_user_data | ( | ) |
Definition at line 625 of file FetchSM.cc.
void FetchSM::ext_init | ( | Continuation * | cont, | |
const char * | method, | |||
const char * | url, | |||
const char * | version, | |||
const sockaddr * | client_addr, | |||
int | flags | |||
) |
Definition at line 472 of file FetchSM.cc.
References IpEndpoint::assign(), init_comm(), Continuation::mutex, new_ProxyMutex(), set_internal_request(), TS_FETCH_FLAGS_NOT_INTERNAL_REQUEST, TS_FETCH_FLAGS_STREAM, and MIOBuffer::write().
Referenced by TSFetchCreate().
void FetchSM::ext_lanuch | ( | ) |
Definition at line 527 of file FetchSM.cc.
References httpConnect(), and MIOBuffer::write().
ssize_t FetchSM::ext_read_data | ( | char * | buf, | |
size_t | len | |||
) |
Definition at line 550 of file FetchSM.cc.
References ChunkedHandler::dechunked_reader, memcpy, Continuation::mutex, MUTEX_TRY_LOCK, VIO::reenable(), start, this_ethread(), TSIOBufferBlockNext(), TSIOBufferBlockReadStart(), TSIOBufferReaderConsume(), and TSIOBufferReaderStart().
void FetchSM::ext_set_user_data | ( | void * | data | ) |
Definition at line 619 of file FetchSM.cc.
void FetchSM::ext_write_data | ( | const void * | data, | |
size_t | len | |||
) |
Definition at line 534 of file FetchSM.cc.
References __FUNCTION__, Debug, DEBUG_TAG, Continuation::mutex, MUTEX_TAKE_LOCK, MUTEX_UNTAKE_LOCK, VIO::reenable(), this_ethread(), and MIOBuffer::write().
int FetchSM::fetch_handler | ( | int | event, | |
void * | data | |||
) |
Definition at line 452 of file FetchSM.cc.
References __FUNCTION__, cleanUp(), Debug, DEBUG_TAG, TSFetchEvent::failure_event_id, process_fetch_read(), process_fetch_write(), and TS_FETCH_FLAGS_STREAM.
Referenced by init_comm().
void FetchSM::get_info_from_buffer | ( | IOBufferReader * | reader | ) |
Definition at line 285 of file FetchSM.cc.
References __FUNCTION__, ats_malloc(), IOBufferReader::block, ChunkedHandler::CHUNK_FLOW_CONTROL, IOBufferReader::consume(), Debug, DEBUG_TAG, ChunkedHandler::dechunked_reader, memcpy, IOBufferBlock::read_avail(), IOBufferReader::read_avail(), IOBufferReader::skip_empty_blocks(), IOBufferBlock::start(), IOBufferReader::start_offset, ChunkedHandler::state, and TS_FETCH_FLAGS_STREAM.
Referenced by process_fetch_read().
void FetchSM::httpConnect | ( | ) |
Definition at line 55 of file FetchSM.cc.
References __FUNCTION__, Debug, DEBUG_TAG, PluginVC::do_io_read(), PluginVC::do_io_write(), PluginIdentity::getPluginId(), PluginIdentity::getPluginTag(), INT64_MAX, IpEndpoint::sa, NetVConnection::set_is_internal_request(), and TSHttpConnectWithPluginId().
Referenced by ext_lanuch(), TSFetchPages(), and TSFetchUrl().
void FetchSM::init | ( | Continuation * | cont, | |
TSFetchWakeUpOptions | options, | |||
TSFetchEvent | events, | |||
const char * | headers, | |||
int | length, | |||
sockaddr const * | addr | |||
) | [inline] |
Definition at line 70 of file FetchSM.h.
References __FUNCTION__, IpEndpoint::assign(), Debug, init_comm(), Continuation::mutex, new_ProxyMutex(), and MIOBuffer::water_mark.
Referenced by TSFetchPages(), and TSFetchUrl().
void FetchSM::init_comm | ( | ) | [inline] |
Definition at line 46 of file FetchSM.h.
References MIOBuffer::alloc_reader(), BUFFER_SIZE_INDEX_32K, Ptr< T >::clear(), HTTPHdr::create(), fetch_handler(), HTTP_HEADER_BUFFER_SIZE_INDEX, http_parser_init(), HTTP_TYPE_RESPONSE, new_MIOBuffer, and SET_HANDLER.
Referenced by ext_init(), and init().
void FetchSM::process_fetch_read | ( | int | event | ) |
Definition at line 366 of file FetchSM.cc.
References __FUNCTION__, AFTER_BODY, AFTER_HEADER, cleanUp(), IOBufferReader::consume(), Debug, DEBUG_TAG, TSFetchEvent::failure_event_id, get_info_from_buffer(), HTTPHdr::parse_resp(), IOBufferReader::read_avail(), VIO::reenable(), TSFetchEvent::success_event_id, TS_EVENT_ERROR, TS_EVENT_VCONN_EOS, TS_EVENT_VCONN_READ_COMPLETE, TS_EVENT_VCONN_READ_READY, TS_FETCH_FLAGS_STREAM, and MIOBuffer::write().
Referenced by fetch_handler().
void FetchSM::process_fetch_write | ( | int | event | ) |
Definition at line 427 of file FetchSM.cc.
References __FUNCTION__, cleanUp(), Debug, DEBUG_TAG, TSFetchEvent::failure_event_id, IOBufferReader::read_avail(), TS_EVENT_ERROR, TS_EVENT_VCONN_WRITE_COMPLETE, TS_EVENT_VCONN_WRITE_READY, and TS_FETCH_FLAGS_STREAM.
Referenced by fetch_handler().
char * FetchSM::resp_get | ( | int * | length | ) |
Definition at line 80 of file FetchSM.cc.
Referenced by TSFetchRespGet().
TSMBuffer FetchSM::resp_hdr_bufp | ( | ) |
Definition at line 631 of file FetchSM.cc.
TSMLoc FetchSM::resp_hdr_mloc | ( | ) |
Definition at line 640 of file FetchSM.cc.
References HTTPHdr::m_http.
void FetchSM::set_internal_request | ( | bool | val | ) | [inline] |
Definition at line 124 of file FetchSM.h.
Referenced by ext_init().