]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
radosgw/swift: clean up flush / newline behavior. 13143/head
authorMarcus Watts <mwatts@redhat.com>
Wed, 11 Jan 2017 05:06:15 +0000 (00:06 -0500)
committerMatt Benjamin <mbenjamin@redhat.com>
Thu, 26 Jan 2017 20:12:10 +0000 (15:12 -0500)
commit39848e41b7c517cc5faab1ccf77c2804fd7d2628
tree778f998c1e56b7a703e982b2183f30666e18ae5e
parent3dbf0c9033a9aaa972d1d85d5f7c166becd1f043
radosgw/swift: clean up flush / newline behavior.

The current code emits a newline after swift errors, but fails
to account for it when it calculates 'content-length'.  This results in
some clients (go github.com/ncw/swift) producing complaints about the
unsolicited newline such as this,
Unsolicited response received on idle HTTP channel starting with "\n"; err=<nil>

This logic eliminates the newline on flush.  This makes the content length
calculation correct and eliminates the stray newline.

There was already existing separator logic in the rgw plain formatter
that can emit a newline at the correct point.  It had been checking
"len" to decide if previous data had been emitted, but that's reset to 0
by flush().  So, this logic adds a new per-instance variable to separately
track state that it emitted a previous item (and should emit a newline).

Fixes: http://tracker.ceph.com/issues/18473
Signed-off-by: Marcus Watts <mwatts@redhat.com>
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
(cherry picked from commit 5f229d6a33eae4906f22cdb90941835e47ee9f02)
src/rgw/rgw_formats.cc
src/rgw/rgw_formats.h