Home

Traffic Server Software Developers Kit

Initiate Connection

INKHttpConnect

Sends an HTTP request through the Traffic Server HTTP SM.

Prototype

InkReturnCode INKHttpConnect (unsigned int ip, int port, INKVConn *vc)

Arguments

unsigned int ip is the IP address used to set the value of the vconnection remote IP address. This is equivalent to a client IP address, or the IP from which the connection originated. Value is in host byte order.

int port is the port used to set the value of the vconnection remote port. This is equivalent to a client port, or the port from which the connection originated. The value is in host byte order.

INKVConn *vc is the vconnection returned.

Once the vconnection is established, you can use regular vconnection operations (INKVConnRead, INKVConnWrite, etc).

Description

Sends an HTTP request through the Traffic Server HTTP SM. The HTTP request goes through the Traffic Server the same way a request from a client (such as a browser) does. A typical usage scenario is as follows:

  • Call INKHttpConnect.

  • Use INKVConnWrite to send an HTTP request.

  • Use INKVConnRead to get the HTTP response.

  • Use INKHttpParser to parse the response (if needed).

Note: the request and response go through the Traffic Server HTTP SM. The request and the response can be cached and the transaction will be logged in squid.log.

Also note that the IP address passed to INKHttpConnect will be used as the client IP address in squid.log

Returns

INK_SUCCESS if the API is called successfully.

INK_ERROR if an error occurs while calling the API or if an argument is invalid.