Chunked Payload and vbComplete

Asked by Jatin

When transfer encoding is chunked then how does ecap adapter decide the end of payload and mark vbComplete as true.

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 adapter can tell that no new HTTP message body bytes will be available (i.e. no more noteVbContentAvailable() calls) when the host application calls adapter::Xaction::noteVbContentDone(). This applies to all requests methods and all response status codes. This applies to all message transfer encodings, including chunked.

Revision history for this message
Alex Rousskov (rousskov) said :
#2

Please note that whether the entire virgin message body has been made available to the adapter by the host application depends on the noteVbContentDone() parameter value -- that atEnd parameter should be false if the body was truncated (e.g., the client did not sent the last-chunk before closing the connection to the proxy).

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

What causes the host application to call adapter::Xaction::noteVbContentDone()?
 In my adapter I hold the data for sometime as I am scanning the content the way it's done by clam av adapter. This works fine for most but does not for Google Voice to Text translation.
In the request I noticed that the ecap adapter keeps receiving data and adapter::Xaction::noteVbContentDone() is never called causing the request to eventually timeout.

Revision history for this message
Alex Rousskov (rousskov) said :
#4

> What causes the host application to call adapter::Xaction::noteVbContentDone()?

The end of virgin message body, as detected by the host application code, using HTTP protocol rules and such. When dealing with a chunked request, the body ends when the client sends last-chunk (i.e. the special zero-length chunk). The host application should know that and should call noteVbContentDone() after receiving and parsing last-chunk.

Revision history for this message
Alex Rousskov (rousskov) said :
#5

Please note that the client may not send last-chunk until seeing some or all of the origin server response. I do not know whether your particular client does that, but, AFAIK, there is nothing in HTTP protocol that prevents this kind of delay/wait, especially between a custom client and a custom origin server that expect that they are talking directly to each other.

Can you help with this problem?

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

To post a message you must log in.