插入https json返回字符串的特殊字符

时间:2012-03-21 10:23:08

标签: ruby-on-rails json curl https nginx

当使用curl获取JSON字符串时,我的json字符串中出现了一些奇怪的字符。这些字符在HEX中是“0d 0a 32 30 30 30 0d 0a”,它们在返回的JSON字符串中重复多次。我正在使用https,rails服务器和Nginx。但是,如果我将rails服务器与Webrick等其他Web服务器一起使用,我就没有这样的问题。

curl --trace output

1c60: 6c 65 66 74 5f 63 6f 72 6e 65 72 22 3a 6e 75 6c left_corner":nul
1c70: 6c 2c 22 6c 65 0d 0a 32 30 30 30 0d 0a 66 74 5f l,"le..2000..ft_
1c80: 68 65 69 67 68 74 22 3a 6e 75 6c 6c 2c 22 72 69 height":null,"ri

curl --trace-ascii输出

1c46: eft_leg_child_size":null,"left_corner":null,"le
1c77: 2000
1c7d: ft_height":null,

1 个答案:

答案 0 :(得分:0)

响应是否具有Transfer-Encoding:chunked标头?看起来它可能是一个块长度标签。