原始文献 / 论坛帖 / Re: Content-Length header and 500 (was Re: Authentication, JSON RPC and Python)

Re: Content-Length header and 500 (was Re: Authentication, JSON RPC and Python)

Bitcointalk · 2010-08-03 21:26:26 UTC

AuthorSatoshi Nakamoto
TitleRe: Content-Length header and 500 (was Re: Authentication, JSON RPC and Python)
Date2010-08-03 21:26:26 UTC
ForumBitcointalk · 原文

【引用 gavinandresen 于 2010年8月3日 18:56:44(https://bitcointalk.org/index.php?topic=689.msg7299#msg7299)】

"
【引用 jgarzik 于 2010年8月3日 18:09:08(https://bitcointalk.org/index.php?topic=689.msg7288#msg7288)】
bitcoin 要求 Content-Length 头,但有几个 JSON-RPC 库不提供它。当 Content-Length 头缺失时,bitcoin 返回 500 Internal Server Error。
"
你能具体说是哪些 JSON 库不提供 Content-Length 吗?能记录下来就好了。

我想我们应该尝试支持没有 Content-Length 参数的情况。不过我不想大改流处理,即使不得不一次读一个字符。

补充:前提是真有不支持 Content-Length 的库存在。

英文原文

【引用 gavinandresen on August 03, 2010, 06:56:44 PM(https://bitcointalk.org/index.php?topic=689.msg7299#msg7299)】

"
【引用 jgarzik on August 03, 2010, 06:09:08 PM(https://bitcointalk.org/index.php?topic=689.msg7288#msg7288)】
bitcoin requires the Content-Length header, but several JSON-RPC libraries do not provide it. When the Content-Length header is absent, bitcoin returns 500 Internal Server Error.
"
Can you be more specific about which JSON libraries don't provide Content-Length ? It'd be nice to document that.

I guess we should try to support the case where there's no Content-Length parameter. I don't want to rip and replace streams though, even if it has to read one character at a time.

Edit: That is, assuming there actually are any libraries that don't support Content-Length.