mirror of
https://github.com/distribution/distribution.git
synced 2025-09-16 07:09:49 +00:00
Extract request utilities into its own package
The RemoteAddr and RemoteIP functions operate on *http.Request values, not contexts. They have very low cohesion with the rest of the package. Signed-off-by: Cory Snider <csnider@mirantis.com>
This commit is contained in:
@@ -5,7 +5,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/distribution/distribution/v3"
|
||||
"github.com/distribution/distribution/v3/internal/dcontext"
|
||||
"github.com/distribution/distribution/v3/internal/requestutil"
|
||||
"github.com/distribution/reference"
|
||||
events "github.com/docker/go-events"
|
||||
"github.com/google/uuid"
|
||||
@@ -49,7 +49,7 @@ func NewBridge(ub URLBuilder, source SourceRecord, actor ActorRecord, request Re
|
||||
func NewRequestRecord(id string, r *http.Request) RequestRecord {
|
||||
return RequestRecord{
|
||||
ID: id,
|
||||
Addr: dcontext.RemoteAddr(r),
|
||||
Addr: requestutil.RemoteAddr(r),
|
||||
Host: r.Host,
|
||||
Method: r.Method,
|
||||
UserAgent: r.UserAgent(),
|
||||
|
Reference in New Issue
Block a user