您好, 大侠
非常感谢你能帮我调试,但不知道你是用的什么高深的调试工具,可以得到完整的包,但我只是拿PHP做了一下模拟接收的例子,其他语言也一样会有问题的。
包括使用ngx_lua
location /save {
default_type text/html;
lua_need_request_body on;
content_by_lua '
ngx.log(ngx.ERR, ngx.var.request_body)
';
}
请确保您的resty-http是刚从github上clone下来的,而没被修改过。
“你的经典句典,不仅侮辱了我智商,还侮辱了PHP低层开发者的智商。”
经过查找,确实是resty-http的问题了,将前面的local h="\r\n" 换成local h=""即可,去掉后面那行貌似也可以没试
On Thursday, December 27, 2012 10:16:33 AM UTC+8, smallfish wrote:
我试了下你的两个测试代码,body 都可以完整获取到的哦。php://input 是不是多次读取了?手动 tcpdump 抓包一下看看
On Thu, Dec 27, 2012 at 1:46 AM, 杨嵩
<net...@gmail.com> wrote:
lua代码
local http = require("resty.http")
local hc = http:new()
local ok, code, headers, status, body = hc:request {
url = "">
timeout = 2000,
method = "POST",
keepalive = false,
body = "1234567890"
}
php代码
<?php
file_put_contents('/tmp/t.txt', file_get_contents('php://input'));
发送的body是1234567890,接收到的确是12345678