Unable to get Request URL

Asked by Jatin

Hi Alex,

I am currently working on adapter_minimal.cc for version 0.2.0.
In function void Adapter::Xaction::start() I added following lines from one of your FAQ:

    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();

But I get compilation error:
error: expected initializer before ‘*’ token ( This error is for line typedef const libecap::RequestLine *CLRLP;)

To remove this error I added header file #include <libecap/common/header.h> and on compiling again I get following errors:

adapter_minimal.cc: In member function ‘virtual void Adapter::Xaction::start()’:
adapter_minimal.cc:144: error: invalid use of incomplete type ‘struct libecap::Message’
/usr/local/include/libecap/common/forward.h:18: error: forward declaration of ‘struct libecap::Message’
adapter_minimal.cc:144: warning: unused variable ‘requestLine’
adapter_minimal.cc: At global scope:
adapter_minimal.cc:169: warning: ‘Registered’ defined but not used
make[2]: *** [adapter_minimal.lo] Error 1
make[2]: Leaving directory `/usr/libecap/ecap_adapter_sample-0.2.0/src'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/usr/libecap/ecap_adapter_sample-0.2.0/src'
make: *** [all-recursive] Error 1

Thanks,
Jatin

Question information

Language:
English Edit question
Status:
Solved
For:
eCAP Edit question
Assignee:
No assignee Edit question
Solved by:
Jatin
Solved:
Last query:
Last reply:

This question was reopened

Revision history for this message
Jatin (jbhasin83) said :
#1

Jatin suggests this article as an answer to your question:
FAQ #1576: “How an adapter can get requested URL?”.

Revision history for this message
Jatin (jbhasin83) said :
#2

Hi Alex,

I have attached the FAQ which I used but getting compilation errors.

Revision history for this message
Jatin (jbhasin83) said :
#3

Hi Alex,

I think I have solved the issue. I added following header files in the adapter_minimal.cc and the compilation error was gone.

#include <libecap/common/header.h>
#include <libecap/common/message.h>

Please confirm if this is the fix for this issue.

Thanks,
Jatin

Revision history for this message
Jatin (jbhasin83) said :
#4

Thanks. Reading other topics and reading the code helped me solved my query