mirror of
https://github.com/willnorris/imageproxy.git
synced 2026-05-03 00:32:40 +02:00
Add ability to restrict http referrer
This commit is contained in:
parent
8c13d93bde
commit
9213c93c94
5 changed files with 68 additions and 15 deletions
7
data.go
7
data.go
|
|
@ -196,8 +196,9 @@ func ParseOptions(str string) Options {
|
|||
// Request is an imageproxy request which includes a remote URL of an image to
|
||||
// proxy, and an optional set of transformations to perform.
|
||||
type Request struct {
|
||||
URL *url.URL // URL of the image to proxy
|
||||
Options Options // Image transformation to perform
|
||||
URL *url.URL // URL of the image to proxy
|
||||
Options Options // Image transformation to perform
|
||||
Original *http.Request // The original HTTP request
|
||||
}
|
||||
|
||||
// String returns the request URL as a string, with r.Options encoded in the
|
||||
|
|
@ -223,7 +224,7 @@ func (r Request) String() string {
|
|||
// http://localhost/http://example.com/image.jpg
|
||||
func NewRequest(r *http.Request, baseURL *url.URL) (*Request, error) {
|
||||
var err error
|
||||
req := new(Request)
|
||||
req := &Request{Original: r}
|
||||
|
||||
path := r.URL.Path[1:] // strip leading slash
|
||||
req.URL, err = url.Parse(path)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue