How an adapter can get requested URL?

Created by Alex Rousskov on on 2011-04-29
Keywords:
Last updated by:
Alex Rousskov on on 2011-04-29

libecap::host::Xaction::virgin() method gives access to the request message in REQMOD.
libecap::host::Xaction::cause() method gives access to the request message in RESPMOD.

Once you have the request message, you can access its Request-URI via the firstLine() method:

    libecap::Area uri;
    typedef const libecap::RequestLine *CLRLP;
    if (CLRLP requestLine = dynamic_cast<CLRLP>(&hostx->virgin().firstLine()))
            uri = requestLine->uri();
    else
    if (CLRLP requestLine = dynamic_cast<CLRLP>(&hostx->cause().firstLine()))
            uri = requestLine->uri();

The above working example handles both REQMOD and RESPMOD and is taken from the Adapter::Xaction::getUri() method in the ClamAV adapter.