Transactions are the object containing all the state related to a HTTP Transaction.
More...
#include "Transaction.h"
Inherits atscppapi::noncopyable.
|
class | ContextValue |
| ContextValues are a mechanism to share data between plugins using the atscppapi. More...
|
|
Transactions are the object containing all the state related to a HTTP Transaction.
- Warning
- Transactions should never be directly created by the user, they will always be automatically created and destroyed as they are needed. Transactions should never be saved beyond the scope of the function in which they are delivered otherwise undefined behaviour will result.
The available types of timeouts you can set on a Transaction.
Enumerator |
---|
TIMEOUT_DNS |
Timeout on DNS
|
TIMEOUT_CONNECT |
Timeout on Connect
|
TIMEOUT_NO_ACTIVITY |
Timeout on No Activity
|
TIMEOUT_ACTIVE |
Timeout with Activity
|
void Transaction::error |
( |
| ) |
|
void Transaction::error |
( |
const std::string & |
content | ) |
|
Causes the Transaction to advance to the error state in the HTTP state machine with a specific error message displayed. This is functionally equivalent to the following:
- Parameters
-
content | the error page body. |
void * Transaction::getAtsHandle |
( |
| ) |
const |
Returns the TSHttpTxn related to the current Transaction
- Returns
- a void * which can be cast back to a TSHttpTxn.
const sockaddr * Transaction::getClientAddress |
( |
| ) |
const |
Returns the ClientRequest object for the incoming request from the client.
- Returns
- ClientRequest object that can be used to manipulate the incoming request from the client.
Response & Transaction::getClientResponse |
( |
| ) |
|
Returns a Response object which is the response going to the client
- Returns
- Response object that can be used to manipulate the outgoing response from the client.
Context Values are a way to share data between plugins, the key is always a string and the value can be a shared_ptr to any type that extends ContextValue.
- Parameters
-
key | the key to search for. |
- Returns
- Shared pointer that is correctly initialized if the value existed. It should be checked with .get() != NULL before use.
string Transaction::getEffectiveUrl |
( |
| ) |
|
Returns the Effective URL for this transaction taking into account host.
const sockaddr * Transaction::getIncomingAddress |
( |
| ) |
const |
const sockaddr * Transaction::getNextHopAddress |
( |
| ) |
const |
Get the next hop address
- Returns
- The sockaddr structure representing the next hop's address
- See Also
- atscppapi::utils::getIpString() in atscppapi/utils.h
-
atscppapi::utils::getPort() in atscppapi/utils.h
-
atscppapi::utils::getIpPortString in atscppapi/utils.h
const sockaddr * Transaction::getServerAddress |
( |
| ) |
const |
Request & Transaction::getServerRequest |
( |
| ) |
|
Returns a Request object which is the request from Traffic Server to the origin server.
- Returns
- Request object that can be used to manipulate the outgoing request to the origin server.
Response & Transaction::getServerResponse |
( |
| ) |
|
Returns a Response object which is the response coming from the origin server
- Returns
- Response object that can be used to manipulate the incoming response from the origin server.
bool Transaction::isInternalRequest |
( |
| ) |
const |
Returns a boolean value if the request is an internal request. A request is an internal request if it originates from within traffic server. An example would be using TSFetchUrl (or the atscppapi equivalent of AsyncHttpFetch) to make another request along with the original request. The secondary request originated within traffic server and is an internal request.
- Returns
- boolean value specifying if the request was an internal request.
void Transaction::resume |
( |
| ) |
|
bool Transaction::setCacheUrl |
( |
const std::string & |
| ) |
|
Sets the url used by the ATS cache for a specific transaction.
- Parameters
-
url | is the url to use in the cache. |
void Transaction::setContextValue |
( |
const std::string & |
key, |
|
|
shared_ptr< ContextValue > |
value |
|
) |
| |
Context Values are a way to share data between plugins, the key is always a string and the value can be a shared_ptr to any type that extends ContextValue.
- Parameters
-
key | the key to insert. |
value | a shared pointer to a class that extends ContextValue. |
void Transaction::setErrorBody |
( |
const std::string & |
content | ) |
|
Sets the error body page but this method does not advance the state machine to the error state. To do that you must explicitally call error().
- Parameters
-
content | the error page content. |
bool Transaction::setIncomingPort |
( |
uint16_t |
port | ) |
|
Set the incoming port on the Transaction
- Parameters
-
port | is the port to set as the incoming port on the transaction |
bool Transaction::setServerAddress |
( |
const sockaddr * |
sockaddress | ) |
|
Sets the server address on the Transaction to a populated sockaddr *
- Parameters
-
sockaddr* | the sockaddr structure populated as the server address. |
Allows you to set various types of timeouts on a Transaction
- Parameters
-
type | The type of timeout |
time_ms | The timeout time in milliseconds |
- See Also
- TimeoutType
The documentation for this class was generated from the following files: