Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Zend\Http\Client\Adapter\Curl does not send a proper DELETE request when request body is provided, hangs #6315

Closed
lucian303 opened this issue May 22, 2014 · 1 comment
Assignees
Milestone

Comments

@lucian303
Copy link
Contributor

When providing a request body for a DELETE request, Zend\Http\Client will add the 'Content-Length' header but will not add and send the actual body resulting in a curl call that hangs for a very long period of time. The client should either send both a body and the header or neither. Since DELETE requests can have a body, I'd suggest sending both. From the IETF spec: "The presence of a message-body in a request is signaled by the inclusion of a Content-Length or Transfer-Encoding header field in the request's message-headers." -- http://tools.ietf.org/html/rfc2616

To fix, Zend\Http\Client\Adapter\Curl line 396 (ZF 2.2.7) should have an additional elseif to add the body to DELETE requests as well (or the 'Content-Length' header removed before sending the request), ideally the first option as below:

        } elseif ($method == 'DELETE') {
            curl_setopt($this->curl, CURLOPT_POSTFIELDS, $body);
        }
@Ocramius
Copy link
Member

Handled in #6318

gianarb pushed a commit to zendframework/zend-http that referenced this issue May 15, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants