Commit graph

4 commits

Author SHA1 Message Date
Konrad Wojas
d4cd47e503 Minor cleanup and fixes
- Do not allow '.' as path component, because it undermines depth
  checks, and add tests
- Fix GiB reporting
- Fix metrics label
- Helper function for http errors
2021-08-09 10:49:41 +02:00
Konrad Wojas
1f593fafaf Make Server use the new repo.Handler
This contains all the glue to make Server use the new repo.Handler:

- Remove all old handlers
- Add ServeHTTP to make Server a single http.Handler
- Remove Goji routing and replace by net/http and custom routing logic

Additionally, this implements two-level backup repositories.
2021-08-09 10:49:41 +02:00
Konrad Wojas
79a8785e26 Implement repo.Handler
Refactor the old HTTP handlers to fit the purpose of the new
http.Handler:

- repo.New function to instantiate a handler for a single repo (can be done
  dynamically for every request)
- Single ServeHTTP entrypoint
- Move quota management to two methods that will be implemented later
  (stubs for now)
- Move metrics update to an external function (BlobMetricFunc type)
- Use constants and options for file modes
2021-08-09 10:49:41 +02:00
Konrad Wojas
7f14414363 Add repo package with copy of old handlers.go
Copy the old handlers.go without changes for cleaer diff of
changes later.
2021-08-09 10:49:41 +02:00