Skip to content

Instantly share code, notes, and snippets.

@hostmaster
Created November 27, 2012 18:39
Show Gist options
  • Save hostmaster/4156129 to your computer and use it in GitHub Desktop.
Save hostmaster/4156129 to your computer and use it in GitHub Desktop.
transformable_request
int
transformable_request (TSHttpTxn txnp)
{
TSMBuffer req_bufp;
TSMLoc req_loc;
TSMLoc field_loc;
const char* user_agent_value = NULL;
int user_agent_length = -1;
TSHttpTxnClientReqGet(txnp, &req_bufp, &req_loc);
field_loc = TSMimeHdrFieldFind(req_bufp, req_loc, TS_MIME_FIELD_USER_AGENT, TS_MIME_LEN_USER_AGENT);
user_agent_value = TSMimeHdrFieldValueStringGet(req_bufp, req_loc, field_loc, 0, &user_agent_length);
TSDebug(DBG_TAG, "UA: %s", user_agent_value);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment