diff options
author | Linus Nordberg <linus@nordu.net> | 2014-05-20 16:07:07 +0200 |
---|---|---|
committer | Linus Nordberg <linus@nordu.net> | 2014-05-20 16:07:07 +0200 |
commit | 6febc30a55d427f709da15181dadfc65fc2d0afd (patch) | |
tree | 180a14ff328b91c338a3e93b74ed2e0f45f5f9db /src/v1.erl | |
parent | 61a29feb448b7edc164bb15b9e913ec1f2333b07 (diff) |
Don't crash when reporting bad input to add-chain.
Diffstat (limited to 'src/v1.erl')
-rw-r--r-- | src/v1.erl | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -21,7 +21,7 @@ add_chain(SessionID, _Env, Input) -> {signature, base64:encode( list_to_binary(plop:serialise(SPT#spt.signature)))}], - jiffy:encode({R}); + binary_to_list(jiffy:encode({R})); _ -> html("add-chain: missing input: chain; see RFC 6962", Input) end, deliver(SessionID, Res). @@ -40,7 +40,7 @@ get_sth(SessionID, _Env, _Input) -> {sha256_root_hash, base64:encode(Roothash)}, {tree_head_signature, base64:encode( list_to_binary(plop:serialise(Signature)))}], - deliver(SessionID, jiffy:encode({R})). + deliver(SessionID, binary_to_list(jiffy:encode({R}))). get_sth_consistency(SessionID, _Env, _Input) -> niy(SessionID). @@ -53,7 +53,7 @@ get_entry_and_proof(SessionID, _Env, _Input) -> get_roots(SessionID, _Env, _Input) -> R = [{certificates, []}], % NIY. - deliver(SessionID, jiffy:encode({R})). + deliver(SessionID, binary_to_list(jiffy:encode({R}))). %% For testing. FIXME: Remove. hello(SessionID, Env, Input) -> @@ -79,5 +79,6 @@ html(Text, Input) -> niy(S) -> mod_esi:deliver(S, html("NIY - Not Yet Implemented|", [])). +-spec deliver(any(), string()) -> ok | {error, _Reason}. deliver(Session, Data) -> - mod_esi:deliver(Session, binary_to_list(Data)). + mod_esi:deliver(Session, Data). |