mirror of
https://github.com/willnorris/imageproxy.git
synced 2026-04-25 04:46:24 +02:00
parent
702a07e3b5
commit
9837a20ddd
2 changed files with 79 additions and 83 deletions
|
|
@ -22,9 +22,18 @@ import (
|
|||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// URLError reports a malformed URL error.
|
||||
type URLError struct {
|
||||
Message string
|
||||
URL *url.URL
|
||||
}
|
||||
|
||||
func (e URLError) Error() string {
|
||||
return fmt.Sprintf("malformed URL %q: %s", e.URL, e.Message)
|
||||
}
|
||||
|
||||
// Options specifies transformations that can be performed on a
|
||||
// requested image.
|
||||
type Options struct {
|
||||
|
|
@ -153,20 +162,3 @@ func NewRequest(r *http.Request) (*Request, error) {
|
|||
req.URL.RawQuery = r.URL.RawQuery
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// Image represents a remote image that is being proxied. It tracks where
|
||||
// the image was originally retrieved from and how long the image can be cached.
|
||||
type Image struct {
|
||||
// URL of original remote image.
|
||||
URL string
|
||||
|
||||
// Expires is the cache expiration time for the original image, as
|
||||
// returned by the remote server.
|
||||
Expires time.Time
|
||||
|
||||
// Etag returned from server when fetching image.
|
||||
Etag string
|
||||
|
||||
// Bytes contains the actual image.
|
||||
Bytes []byte
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue