Commit b9bbb557 authored by Daniel Kraft's avatar Daniel Kraft
Browse files

Fix HTTP connection code.

Instead of using the available stream data, use the full length as per
the Content-Length response field.  Otherwise it may fail for a remote
connection (particularly).
parent f4edaa47
......@@ -4,6 +4,8 @@ ChangeLog for NameID Login Extension
Version 0.6.1 (trunk):
* Add an extension icon.
* Fix warning given by Mozilla add-on checker.
* Fix a problem with the JSON-RPC connection (mostly relevant when
connecting to a remote daemon).
Version 0.5a (2014-07-01):
* Whitelist nameid.bit and id.bit by default, too.
NameID, a namecoin based OpenID identity provider.
Copyright (C) 2013 by Daniel Kraft <>
Copyright (C) 2013,2015 by Daniel Kraft <>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -106,13 +106,13 @@ Namecoind.prototype =
ch.requestMethod = "POST";
s = ();
var avail = s.available ();
if (avail === 0)
var len = ch.getResponseHeader ("Content-Length");
if (len === 0)
s.close ();
throw "The connection to your local namecoind failed.";
var string = NetUtil.readInputStreamToString (s, avail, null);
var string = NetUtil.readInputStreamToString (s, len, null);
s.close ();
/* Sometimes accessing responseStatus throws. Catch this and fail
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment