Designate returns non-zero Content-Length on some HTTP 204's

Bug #1592153 reported by Tim Simmons
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Designate
Fix Released
Undecided
Tim Simmons
Mitaka
Fix Committed
Undecided
Tim Simmons
Newton
Fix Released
Undecided
Unassigned

Bug Description

It appears that some calls that return an HTTP 204 No Content status, Designate returns a non-zero content-length:

curl -v -X POST http://127.0.0.1:9001/v2/zones/a143f01a-5b1e-4925-a52d-cfa1fe2ac5f9/tasks/abandon
* Hostname was NOT found in DNS cache
* Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 9001 (#0)
> POST /v2/zones/a143f01a-5b1e-4925-a52d-cfa1fe2ac5f9/tasks/abandon HTTP/1.1
> User-Agent: curl/7.38.0
> Host: localhost
> Accept: */*
>
< HTTP/1.1 204 No Content
< Content-Length: 2
< X-Openstack-Request-Id: req-fac74a00-e20e-4e15-b6e6-3f1d74167172
< Date: Mon, 13 Jun 2016 19:19:54 GMT
<
* Connection #0 to host localhost left intact

On deletes, this can be a problem:

curl -v -X DELETE localhost/v2/zones/tasks/imports/d335f72d-7149-4777-942a-085cdc591650
* Hostname was NOT found in DNS cache
* Trying ::1...
* connect to ::1 port 80 failed: Connection refused
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 80 (#0)
> DELETE /v2/zones/tasks/imports/d335f72d-7149-4777-942a-085cdc591650 HTTP/1.1
> User-Agent: curl/7.38.0
> Host: localhost
> Accept: */*
>
< HTTP/1.1 204 No Content
< Content-Length: 2
< X-Openstack-Request-Id: req-daa146a7-4226-426a-a282-630fb7cebd86
< Date: Mon, 13 Jun 2016 20:01:11 GMT
<
* Excess found in a non pipelined read: excess = 2 url = /v2/zones/tasks/imports/d335f72d-7149-4777-942a-085cdc591650 (zero-length body)
* Connection #0 to host localhost left intact

Having a body here, and thus a content-length is incorrect:
"The 204 response MUST NOT include a message-body, and thus is always terminated by the first empty line after the header fields."
https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.5

Clients that assume no body, and thus don't continue reading from the socket can run into issues when, on the next read of continued connection, those N number of bytes are sitting there.

The affected calls appear to be:
DELETE /v2/zones/tasks/imports/<id>
DELETE /v2/zones/tasks/exports/<id>
POST /v2/zones/<id>/tasks/abandon

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to designate (master)

Fix proposed to branch: master
Review: https://review.openstack.org/329175

Changed in designate:
assignee: nobody → Tim Simmons (timsim)
status: New → In Progress
Kiall Mac Innes (kiall)
Changed in designate:
milestone: none → newton-2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to designate (master)

Reviewed: https://review.openstack.org/329175
Committed: https://git.openstack.org/cgit/openstack/designate/commit/?id=3171dd5103aa7295b3947cafc35184ccfb9c9659
Submitter: Jenkins
Branch: master

commit 3171dd5103aa7295b3947cafc35184ccfb9c9659
Author: Tim Simmons <email address hidden>
Date: Mon Jun 13 21:00:46 2016 +0100

    Ensure HTTP 204 responses have 0 Content-Length

    These calls are misusing Pecan, and result in '' getting
    serialized to JSON, which has a non-empty content-length
    and that's against the rules of HTTP

    closes-bug: 1592153

    Change-Id: I1407d29c537273b07ab54c4e58c70d9bc4214759

Changed in designate:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to designate (stable/mitaka)

Fix proposed to branch: stable/mitaka
Review: https://review.openstack.org/330153

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to designate (stable/mitaka)

Reviewed: https://review.openstack.org/330153
Committed: https://git.openstack.org/cgit/openstack/designate/commit/?id=7d6ac0a875ea35227620b8866e2d30ec6e6efa69
Submitter: Jenkins
Branch: stable/mitaka

commit 7d6ac0a875ea35227620b8866e2d30ec6e6efa69
Author: Tim Simmons <email address hidden>
Date: Mon Jun 13 21:00:46 2016 +0100

    Ensure HTTP 204 responses have 0 Content-Length

    These calls are misusing Pecan, and result in '' getting
    serialized to JSON, which has a non-empty content-length
    and that's against the rules of HTTP

    closes-bug: 1592153

    Change-Id: I1407d29c537273b07ab54c4e58c70d9bc4214759
    (cherry picked from commit 3171dd5103aa7295b3947cafc35184ccfb9c9659)

Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote : Fix included in openstack/designate 3.0.0.0b2

This issue was fixed in the openstack/designate 3.0.0.0b2 development milestone.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/designate 2.1.0

This issue was fixed in the openstack/designate 2.1.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.