diff options
-rw-r--r-- | NEWS.md | 8 | ||||
-rw-r--r-- | src/plop_compat.erl | 6 | ||||
-rw-r--r-- | src/plop_httputil.erl | 12 | ||||
-rw-r--r-- | src/storage.erl | 2 | ||||
-rw-r--r-- | test/check.config | 5 |
5 files changed, 29 insertions, 4 deletions
@@ -4,7 +4,13 @@ - Signing nodes now requires signatures from a configurable number of storage nodes. This prevents a rouge frontend node from sending out - an SCT for an entry that will never be merged. + an SCT for an entry that will never be merged (closes CATLFISH-28). + +- Send HTTP request body in 512 kB chunks (addresses CATLFISH-98). + +## Bug fixes + +- Support for R19 added. # Changes in plop 0.10.1 - 2017-02-11 diff --git a/src/plop_compat.erl b/src/plop_compat.erl index 4c212de..9a98e3d 100644 --- a/src/plop_compat.erl +++ b/src/plop_compat.erl @@ -22,6 +22,10 @@ unpack_spki("17", SPKI) -> unpack_spki("18", SPKI) -> #'SubjectPublicKeyInfo'{subjectPublicKey = Octets, algorithm = Algorithm} = SPKI, + {Octets, Algorithm}; +unpack_spki("19", SPKI) -> + #'SubjectPublicKeyInfo'{subjectPublicKey = Octets, + algorithm = Algorithm} = SPKI, {Octets, Algorithm}. %% <=R17: now/0, >=R18 timestamp/0 @@ -30,4 +34,6 @@ timestamp("R16" ++ _) -> timestamp("17") -> erlang:now(); timestamp("18") -> + erlang:timestamp(); +timestamp("19") -> erlang:timestamp(). diff --git a/src/plop_httputil.erl b/src/plop_httputil.erl index 67e48ba..81a99b1 100644 --- a/src/plop_httputil.erl +++ b/src/plop_httputil.erl @@ -73,6 +73,16 @@ request(DebugTag, URL, Headers, <<>>) -> request(DebugTag, URL, Headers, RequestBody) -> request(DebugTag, URL, Headers, RequestBody, post). +-define(MAX_CHUNK_SIZE, 512*1024). + +chunk_data(<<>>) -> + eof; +chunk_data(Data) when is_binary(Data) -> + ChunkSize = min(size(Data), ?MAX_CHUNK_SIZE), + lager:debug("~p data left, sending ~p bytes", [size(Data), ChunkSize]), + {Chunk, Rest} = split_binary(Data, ChunkSize), + {ok, Chunk, Rest}. + request(DebugTag, URL, Headers, RequestBody, Method) -> Starttime = os:timestamp(), ParsedURL = hackney_url:parse_url(URL), @@ -99,7 +109,7 @@ request(DebugTag, URL, Headers, RequestBody, Method) -> {Method, Path, add_auth(MethodString, Path, Headers, RequestBody), - RequestBody}), + {fun chunk_data/1, RequestBody}}), lager:debug("~s: received headers for ~p: ~p", [DebugTag, URL, RespHeaders]), {ok, Body} = hackney:body(ClientRef), diff --git a/src/storage.erl b/src/storage.erl index c64d918..7498635 100644 --- a/src/storage.erl +++ b/src/storage.erl @@ -37,7 +37,7 @@ request(post, ?APPURL_PLOP_STORAGE, "entrycommitted", Input) -> undefined -> none; TimestampSignature -> - plop:add_spt(LeafHash, base64:decode(TimestampSignature)) + plop:add_spt_sig(LeafHash, base64:decode(TimestampSignature)) end, success({[{result, <<"ok">>}]}) end; diff --git a/test/check.config b/test/check.config index 57afcca..4180771 100644 --- a/test/check.config +++ b/test/check.config @@ -1 +1,4 @@ -[]. +%% -*- erlang -*- +[{lager, + [{handlers, + [{lager_console_backend, warning}]}]}]. |