Sabredav with no php://input (Kohana)

145 views Asked by At

I have a framework that eats up php://input before sabredav can get to it on a PUT.

Is there a way to call setBody() in Sabre\HTTP\Request so I can pass this from my framework (http://kohanaframework.org) so that getBody() doesn't try to get it from the blank php://input?

I want to try to avoid hacking Sabre\DAV\Server and/or Sabre\HTTP\Request but not sure what the best approach would be.

Framework "wrapped" code is here (implementation of server.php in the Sabredav example)

https://github.com/chrisgo/kohana-sabredav/blob/master/classes/Kohana/Controller/Webdav.php


Original question: SabreDAV + Nginx + PUT (creates 0 byte file)

1

There are 1 answers

0
Chris Go On BEST ANSWER

The cleanest solution seems to be creating a plugin to intercept the PUT method and set the body back into where sabredav is expecting it

public function httpPutInterceptor($method, $uri) {
    $this->server->httpRequest->setBody($this->body);
}

Complete module: https://github.com/chrisgo/kohana-sabredav

... now I just have to figure out why nginx is returning a 405 on a binary file PUT vs a text file PUT (correct behavior, passes it on to PHP)