Transfer-encoding header missing on large payloads
search cancel

Transfer-encoding header missing on large payloads

book

Article ID: 235317

calendar_today

Updated On:

Products

CA API Gateway

Issue/Introduction

Per HTTP Standards it is expected that either a content-length header will be present for responses which are under 8k in size or there should be a transfer-encoding header for responses which are greater than 8k in size.

In gateway 10.1 when dealing with a large response which should require a transfer-encoding header to be present, when the return template response to requestor assertion has the 'Send Response Immediately' option enabled the transfer-encoding header is not present.

When the 'Send Response Immediately' option is not enabled we do see the transfer-encoding header as expected.

Environment

Gateway 10.1

Cause

Gateway version 10.1 upgrades the version of Tomcat to 7 which also sees some changes around RFC compliance in this area.

From the RFC: https://datatracker.ietf.org/doc/html/rfc2616#section-3.6


Whenever a transfer-coding is applied to a message-body, the set of transfer-codings MUST include "chunked", unless the message is terminated by closing the connection. When the "chunked" transfer-coding is used, it MUST be the last transfer-coding applied to the message- body. The "chunked" transfer-coding MUST NOT be applied more than once to a message-body. These rules allow the recipient to determine the transfer-length of the message (section 4.4).

So the "send response immediately" is essentially a connection close. 

Resolution

The situation being observed where no transfer-encoding header is present on responses over 8k in size is expected when the Return Template Response To Requestor assertion had the 'Send Response Immediately' option enabled.