Skip to content

HTTP: support adding a body to a request or response that did not previously have one #86

@mpwarres

Description

@mpwarres

(This issue is semi-related to #64 "HTTP: add control of the end_of_stream flag", arguably they could be coalesced)

In its section on Buffers, the v0.2.1 ABI spec says:

Access to buffers (listed in proxy_buffer_type_t) using functions in this section is restricted to specific callbacks:

  • HTTP_REQUEST_BODY can be read and modified in proxy_on_request_body (or for as long as request processing is paused from it).
  • HTTP_RESPONSE_BODY can be read and modified in proxy_on_response_body (or for as long as response processing is paused from it).

However, in the case of an HTTP request that does not contain a body, or (more rarely) an HTTP response without a body, a plugin will receive a proxy_on_request_headers or proxy_on_response_headers callback with end_of_stream=true, and won't see a proxy_on_*_body callback. This means that if the plugin wants to add a body to the request/response being proxied, it has no way of doing so, since it would need to access the HTTP_REQUEST_BODY or HTTP_RESPONSE_BODY buffer, which is not available.

Some possible solutions:

Among these, (A) seems appealing in that it is a minor change that might even be possible to introduce in the current ABI without breaking plugins. (B) would be a more visible behavior change, and (C) seems less uniform (and more Envoy-specific) WRT the existing setBuffer API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions