how do I get POST request content?

Asked by zas

Hello,

I need to save all info about POST requests to a file, I'm able to get request headers, but have some problem with request content.

In Adapter::Xaction::start I have the following:

 Must(hostx);

 libecap::shared_ptr<libecap::Message> adapted = hostx->virgin().clone();
     if (hostx->virgin().body())
     {
      receivingVb = opOn;
      hostx->vbMake(); // ask host to supply virgin body
     }
    const libecap::Area lenVal = adapted->header().value(libecap::headerContentLength);
    const libecap::Area s = adapted->header().image();//libecap::Header::image();
    if (lenVal)
    {
        const libecap::Area ip = hostx->option(libecap::metaClientIp);
       if (hostx->virgin().body())
       {
           const libecap::Area b = hostx->vbContent(0, libecap::nsize);
           dumping to a file
       }
   }

I expect to have all requests with ContentLength>0 saved into file, however I see that only about 30% are saved.
Sometimes request body is empty.

Any advice is appreciated.

Question information

Language:
English Edit question
Status:
Answered
For:
eCAP Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Alex Rousskov (rousskov) said :
#1

The host application may not yet have the message body at the adapter::Xaction::start() call time. You need to implement various body-related adapter::Xaction methods to get a message body from the host application. This applies to both request (REQMOD) and response (RESPMOD) bodies.

For an example on how to receive a message body, look at the adapter_modifying sample.

Can you help with this problem?

Provide an answer of your own, or ask zas for more information if necessary.

To post a message you must log in.