简体   繁体   English

Sabredav没有php:// input(Kohana)

[英]Sabredav with no php://input (Kohana)

I have a framework that eats up php://input before sabredav can get to it on a PUT. 我有一个框架,在sabredav可以在PUT上获取它之前,它会吃掉php://input

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 ? 有没有一种方法可以在Sabre\\HTTP\\Request调用setBody(),所以我可以从我的框架( http://kohanaframework.org )传递它,这样getBody()不会尝试从空白的 php://input获取它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. 我想尝试避免入侵Sabre\\DAV\\Server和/或Sabre\\HTTP\\Request但不确定最好的方法是什么。

Framework "wrapped" code is here (implementation of server.php in the Sabredav example) 框架“包装”代码在此处(Sabredav示例中server.php的实现)

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


Original question: SabreDAV + Nginx + PUT (creates 0 byte file) 原始问题: SabreDAV + Nginx + PUT(创建0字节文件)

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 最干净的解决方案似乎是创建一个插件来拦截PUT方法,并将主体设置回sabredav期望的位置

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

Complete module: https://github.com/chrisgo/kohana-sabredav 完整的模块: 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) ...现在我只需要弄清楚nginx为什么在二进制文件PUT和文本文件PUT上返回405(正确的行为,将其传递给PHP)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM