From 17e9e4f72b13893443b135bce67b0f55abe4627f Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Sat, 10 May 2014 11:19:59 +0200 Subject: Correct treesize -> tree_size in get-sth response. Move call to mod_esi:deliver into own function, for easier changing of HTTP headers and such. --- src/v1.erl | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/v1.erl b/src/v1.erl index 6007aaa..c7624db 100644 --- a/src/v1.erl +++ b/src/v1.erl @@ -19,10 +19,10 @@ add_chain(SessionID, _Env, Input) -> {timestamp, SPT#spt.timestamp}, {extensions, []}, {signature, base64:encode(SPT#spt.signature)}], - binary_to_list(jiffy:encode({R})); + jiffy:encode({R}); _ -> html("add-chain: missing input: chain; see RFC 6962", Input) end, - mod_esi:deliver(SessionID, Res). + deliver(SessionID, Res). add_pre_chain(SessionID, _Env, _Input) -> niy(SessionID). @@ -33,11 +33,11 @@ get_sth(SessionID, _Env, _Input) -> timestamp = Timestamp, roothash = Roothash, signature = Signature} = plop:sth(), - R = [{treesize, Treesize}, + R = [{tree_size, Treesize}, {timestamp, Timestamp}, {sha256_root_hash, base64:encode(Roothash)}, {tree_head_signature, base64:encode(Signature)}], - mod_esi:deliver(SessionID, binary_to_list(jiffy:encode({R}))). + deliver(SessionID, jiffy:encode({R})). get_sth_consistency(SessionID, _Env, _Input) -> niy(SessionID). @@ -50,7 +50,7 @@ get_entry_and_proof(SessionID, _Env, _Input) -> get_roots(SessionID, _Env, _Input) -> R = [{certificates, []}], % NIY. - mod_esi:deliver(SessionID, binary_to_list(jiffy:encode({R}))). + deliver(SessionID, jiffy:encode({R})). %% For testing. FIXME: Remove. hello(SessionID, Env, Input) -> @@ -75,3 +75,6 @@ html(Text, Input) -> niy(S) -> mod_esi:deliver(S, html("NIY - Not Yet Implemented|", [])). + +deliver(Session, Data) -> + mod_esi:deliver(Session, binary_to_list(Data)). -- cgit v1.1 From 943b9b21f069a91a4417332940539a3015ad6af7 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Tue, 20 May 2014 12:16:28 +0200 Subject: Make 'extensions' field the empty string. Not the empty list. --- src/v1.erl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/v1.erl b/src/v1.erl index 32dabab..9f454fc 100644 --- a/src/v1.erl +++ b/src/v1.erl @@ -17,7 +17,7 @@ add_chain(SessionID, _Env, Input) -> R = [{sct_version, ?PROTOCOL_VERSION}, {id, base64:encode(SPT#spt.logid)}, {timestamp, SPT#spt.timestamp}, - {extensions, []}, + {extensions, base64:encode("")}, {signature, base64:encode( list_to_binary(plop:serialise(SPT#spt.signature)))}], -- cgit v1.1