Skip to content

Commit

Permalink
Merge pull request scality#438 from scality/COMPAT/empty-content-length
Browse files Browse the repository at this point in the history
COMPAT: PUT empty content-lenght header
  • Loading branch information
LaurenSpiegel authored Dec 3, 2016
2 parents e688f24 + 5e819f7 commit 3d194c3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/routes/routePUT.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,16 @@ export default function routePUT(request, response, log, utapi, statsClient) {
log.debug('routing request', { method: 'routePUT' });

if (request.objectKey === undefined || request.objectKey === '/') {
// PUT bucket - PUT bucket ACL

// content-length for object is handled separately below
const contentLength = request.headers['content-length'];
if (contentLength && (isNaN(contentLength) || contentLength === '' ||
contentLength < 0)) {
log.debug('invalid content-length header');
return routesUtils.responseNoBody(
errors.BadRequest, null, response, null, log);
}
request.post = '';
request.on('data', chunk => {
request.post += chunk.toString();
Expand Down

0 comments on commit 3d194c3

Please sign in to comment.