Skip to content
Open
Show file tree
Hide file tree
Changes from 74 commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
af08451
Initial Commit
martinsumner Mar 26, 2026
fd5c2b4
Initial test of get_body
martinsumner Mar 26, 2026
256151c
Fix formatting of new files
martinsumner Mar 26, 2026
ea3034b
Add basic chunking support (receive body)
martinsumner Mar 27, 2026
b815a5c
Add further tests - plus date caching
martinsumner Mar 27, 2026
3c11b94
Add behaviour
martinsumner Mar 27, 2026
b471a74
Formatting
martinsumner Mar 27, 2026
57d1867
Accepting chunked requests in slices
martinsumner Mar 30, 2026
df18274
Formatting
martinsumner Mar 30, 2026
f9469ae
Add initial end-to-end test
martinsumner Mar 30, 2026
2812d4b
Revert clock bakc to ETS, and add negative tests
martinsumner Mar 30, 2026
81d1b4e
Add monitoring of exits on acceptors
martinsumner Mar 31, 2026
f4a27d3
Pass the split path as well as path
martinsumner Mar 31, 2026
be07044
Extend tests, add KV store test
martinsumner Mar 31, 2026
7ccac06
Add file upload/download test
martinsumner Mar 31, 2026
52afe86
Formatting
martinsumner Mar 31, 2026
ab1a5b2
Chunked puts
martinsumner Mar 31, 2026
65a4040
Check keepalive in HTTP 1.0
martinsumner Mar 31, 2026
9333085
Remove webmachine/mochiweb
martinsumner Apr 1, 2026
a011b1d
Remove mochijson2/mochinum - included in rhc
martinsumner Apr 1, 2026
3a1714f
Remove leading empty bin if it occurs
martinsumner Apr 1, 2026
01ddd3f
Use nomatch, and context to be last not first
martinsumner Apr 1, 2026
81beed1
Optimise clock management
martinsumner Apr 2, 2026
c553fe2
Tidy-up initial configuration
martinsumner Apr 3, 2026
697631e
Fix return tuple from security function
martinsumner Apr 3, 2026
ee81ccc
Update riak_api_web_security.erl
martinsumner Apr 3, 2026
adf5b51
Be explicit peer is IP
martinsumner Apr 3, 2026
fa6a194
Missed peer()
martinsumner Apr 3, 2026
94ec8f7
Correct security type for peer
martinsumner Apr 3, 2026
9d66650
Align params type with uri_string:dissect_query
martinsumner Apr 3, 2026
746f98f
Unit test request line error handling
martinsumner Apr 12, 2026
95b5314
Trim both ends of path
martinsumner Apr 12, 2026
b826e48
Use binary split not string split
martinsumner Apr 14, 2026
c9139dd
RFC requires only leading whitespace to be removed from header
martinsumner Apr 14, 2026
1793961
RFC requires trimming both leading and trailing whitespace
martinsumner Apr 14, 2026
261afdc
compile URL separator
martinsumner Apr 14, 2026
b45d244
Revert "compile URL separator"
martinsumner Apr 14, 2026
5d7bb83
Only compile separators if not single character
martinsumner Apr 14, 2026
2af1af0
Extend testing of errors
martinsumner Apr 15, 2026
d564509
Allow for neither content-length or transfer-encoding
martinsumner Apr 17, 2026
07d49b5
Hack improvement to uri parse
martinsumner Apr 18, 2026
6bc535c
Tidy-up changes to parse vs normalise
martinsumner Apr 18, 2026
aa0441e
Don't leave URI elements quoted
martinsumner Apr 22, 2026
24c3964
Handle no auth-headers
martinsumner Apr 23, 2026
c9dbccf
Set recv buffer
martinsumner Apr 24, 2026
7e0e92c
fmt issue
martinsumner Apr 24, 2026
211af58
Remove cached vs uncached clock test
martinsumner Apr 24, 2026
6ec0469
Get Peer and Cert at start of connection
martinsumner Apr 24, 2026
917f6cd
Format fix
martinsumner Apr 24, 2026
ffa7553
Make type definition more consistent
martinsumner Apr 24, 2026
a417d2e
And export type
martinsumner Apr 24, 2026
99b9bab
Increase default backlog
martinsumner Apr 29, 2026
1ce27c5
Basic doc added, with doc-inspired tidying
martinsumner May 1, 2026
8696bd2
Allow overlapping routes with different methods
martinsumner May 5, 2026
cf7c0da
Minor doc fix
martinsumner May 5, 2026
126431e
Apply suggestions from code review - comment typos
martinsumner May 12, 2026
f40e261
Check additional percent encoding scenarios
martinsumner May 13, 2026
da37801
Add specific error if trailer fields added to body
martinsumner May 13, 2026
a96f6c4
Formatting issue
martinsumner May 13, 2026
27d39b8
Changes following initial review
martinsumner May 14, 2026
b9e1271
Extend timeout on connection test
martinsumner May 14, 2026
86fd824
Typo missed from review
martinsumner May 14, 2026
ddb99d3
Make path normalized or split/decoded
martinsumner May 14, 2026
db87d3b
Further updates following review
martinsumner May 15, 2026
1c87497
Ordering of directives
martinsumner May 15, 2026
16e8423
Limit chunk size to < 4GB
martinsumner May 15, 2026
b6e3f56
Change definition of timeout
martinsumner May 15, 2026
c6d9b60
Change PB listener to use new spec - match http
martinsumner May 18, 2026
0ff0c13
Add acceptor pool drain EUnit test
f34nk May 13, 2026
0968cbc
Formatting
martinsumner May 18, 2026
18a1f78
simplify/clarify acceptor pool management on accepted
martinsumner May 18, 2026
f3d1843
Handle encoded path segments
martinsumner May 19, 2026
5f17080
First model
ThomasArts May 15, 2026
0604f85
Error injection with right weight
ThomasArts May 15, 2026
4edd33c
All unicode parameters are handled correctly
ThomasArts May 21, 2026
897b311
Add support for missing white space in headers
martinsumner May 25, 2026
05563c2
fmt
martinsumner May 25, 2026
888cda7
OTP26 compatibility
ThomasArts Jun 1, 2026
8081d74
Merge pull request #5 from ThomasArts/eqc-for-riak_api
martinsumner Jun 9, 2026
7b88e0d
Apply format and add required omissions to gitignore
martinsumner Jun 9, 2026
44043bb
License/Profile check
martinsumner Jun 9, 2026
6801f85
Add temp logs to try and detect point of intermittent failure
martinsumner Jun 9, 2026
205c7dc
Less logs - maybe failure will emerge again
martinsumner Jun 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/erlang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,5 @@ jobs:
run: ./rebar3 do xref, dialyzer
- name: Run eunit
run: ./rebar3 as gha do eunit
- name: Check format
run: ./rebar3 fmt --check
39 changes: 5 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,11 @@

![Riak API OpenRiak Status](https://github.com/OpenRiak/riak_api/actions/workflows/erlang.yml/badge.svg?branch=openriak-4.0)

This OTP application encapsulates services for presenting Riak's
public-facing interfaces. Currently this means a generic interface for
exposing Protocol Buffers-based services; HTTP services via Webmachine
will be moved here at a later time.
This OTP application encapsulates services for presenting Riak's public-facing interfaces.

## Contributing
There two APIs:

We encourage contributions to `riak_api` from the community.
- An API using protocol buffers, with a codec defined in [riak_pb](https://github.com/OpenRiak/riak_pb), with the handling of messages managed using `riak_kv_pb_*` modules within Riak KV.
- A HTTP REST-based API (code-named Silver Machine), with the handling of requests defined using `riak_kv_ag_*` modules that implement the callbacks defined in the `riak_api_web_handler` behaviour.

1. Fork the [`riak_api`](https://github.com/basho/riak_api) repository
on Github.
2. Clone your fork or add the remote if you already have a clone of
the repository.

```
git clone git@github.com:yourusername/riak_api.git
# or
git remote add mine git@github.com:yourusername/riak_api.git
```

3. Create a topic branch for your change.

```
git checkout -b some-topic-branch
```

4. Make your change and commit. Use a clear and descriptive commit
message, spanning multiple lines if detailed explanation is needed.
5. Push to your fork of the repository and then send a pull-request
through Github.

```
git push mine some-topic-branch
```

6. A Basho engineer or community maintainer will review your patch and
merge it into the main repository or send you feedback.
For further information on using [Silver Machine see the provided document](/docs/silverMachine.md).
193 changes: 193 additions & 0 deletions docs/silverMachine.md

Large diffs are not rendered by default.

46 changes: 39 additions & 7 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,52 @@

{erl_opts, [warnings_as_errors]}.

{erlfmt, [
write,
{print_width, 80},
{files, [
"src/riak_api_web_acceptor.erl",
"src/riak_api_web_body.erl",
"src/riak_api_web_headers.erl",
"src/riak_api_web_security.erl",
"src/riak_api_web_socket.erl",
"src/riak_api_web.erl",
"src/riak_api_web_handler.erl",
"test/riak_api_web_acceptor_pool_drain_test.erl",
"test/riak_api_web_get_random.erl",
"test/riak_api_web_ets_store.erl",
"test/riak_api_web_trigger.erl",
"rebar.config"
]},
{exclude_files, []}
]}.

{project_plugins, [
{erlfmt, {git, "https://github.com/OpenRiak/erlfmt.git", {branch, "main"}}}
]}.

{eunit_opts, [verbose]}.

{deps, [
{riak_pb, {git, "https://github.com/OpenRiak/riak_pb.git", {branch, "openriak-3.4"}}},
{webmachine, {git, "https://github.com/OpenRiak/webmachine.git", {branch, "openriak-3.4"}}},
{mochiweb, {git, "https://github.com/OpenRiak/mochiweb.git", {branch, "openriak-3.4"}}},
{riak_core, {git, "https://github.com/OpenRiak/riak_core.git", {branch, "openriak-4.0"}}}
]}.
{riak_pb,
{git, "https://github.com/OpenRiak/riak_pb.git",
{branch, "openriak-3.4"}}},
{riak_core,
{git, "https://github.com/OpenRiak/riak_core.git",
{branch, "openriak-4.0"}}}
]}.

{profiles, [
{test, [{deps, [{meck, {git, "https://github.com/OpenRiak/meck.git", {branch, "openriak-3.4"}}}]}]},
{test, [
{deps, [
{meck,
{git, "https://github.com/OpenRiak/meck.git",
{branch, "openriak-3.4"}}}
]}
]},
{gha, [{erl_opts, [{d, 'GITHUBEXCLUDE'}]}]}
]}.

{dialyzer, [{plt_apps, all_deps}]}.

{xref_checks,[undefined_function_calls,undefined_functions,locals_not_used]}.
{xref_checks, [undefined_function_calls, undefined_functions, locals_not_used]}.
4 changes: 1 addition & 3 deletions src/riak_api.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
stdlib,
ssl,
riak_core,
riak_pb,
webmachine,
mochiweb
riak_pb
]},
{registered, [riak_api_sup,
riak_api_pb_sup]},
Expand Down
27 changes: 20 additions & 7 deletions src/riak_api_sup.erl
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,18 @@
-include_lib("kernel/include/logger.hrl").

-define(CHILD(I, Type), {I, {I, start_link, []}, permanent, 5000, Type, [I]}).
-define(CHILD(I, Type, Args), {I, {I, start_link, Args}, permanent, 5000, Type, [I]}).
-define(LNAME(IP, Port), lists:flatten(io_lib:format("pb://~p:~p", [IP, Port]))).
-define(PB_LISTENER(IP, Port), {?LNAME(IP, Port),
{riak_api_pb_listener, start_link, [IP, Port]},
permanent, 5000, worker, [riak_api_pb_listener]}).
-define(PB_LISTENER(IP, Port),
#{
id => ?LNAME(IP, Port),
start => {riak_api_pb_listener, start_link, [IP, Port]},
restart => permanent,
shutdown => 5000,
type => worker,
modules => [riak_api_pb_listener]
}
).

%% @doc Starts the supervisor.
-spec start_link() -> {ok, pid()} | {error, term()}.
start_link() ->
Expand All @@ -59,11 +66,17 @@ init([]) ->
%% Generates child specs from the HTTP/HTTPS listener configuration.
%% @private
web_processes([]) ->
?LOG_INFO("No HTTP/HTTPS listeners were configured, HTTP connections will be disabled."),
?LOG_INFO(
"No HTTP/HTTPS listeners were configured, "
"HTTP connections will be disabled."
),
[];
web_processes(Listeners) ->
lists:flatten([ web_listener_spec(Scheme, Binding) ||
{Scheme, Binding} <- Listeners ]).
lists:flatten(
[
web_listener_spec(Scheme, Binding) || {Scheme, Binding} <- Listeners
]
).

web_listener_spec(Scheme, Binding) ->
riak_api_web:binding_config(Scheme, Binding).
Expand Down
Loading
Loading