cache transformed images

fixes #1
This commit is contained in:
Will Norris 2013-12-26 18:31:20 -08:00
parent 702a07e3b5
commit 9837a20ddd
2 changed files with 79 additions and 83 deletions

View file

@ -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
}