Will Norris
b4216d8da8
remove Proxy pointer from TransformingTransport
...
This pointer was only needed to pass along the scaleUp option. In order
to prevent someone from specifying the scaleUp option on an individual
request against the owner's wishes, we didn't encode or decode that
field on the Options struct. Instead, we stored the value on the Proxy
object and then set it on the Options struct inside the
TransformingTransport. This worked, but I never really liked binding
those two together.
Instead, we now treat scaleUp as a normal Option field, encoding and
decoding it with all the others. The primary difference is that the
initial value from the request URL will always be overwritten with
whatever is set in Proxy.ScaleUp. This decouples the
TransformingTransport from the Proxy, but prevents the option from being
set in the request URL.
Modifies #37
2015-12-07 23:06:02 -08:00
Rune Madsen
9a4791d60a
adding cache-control header
2015-09-05 10:51:07 -04:00
Connor Peet
9213c93c94
Add ability to restrict http referrer
2015-08-15 10:36:07 -07:00
Rune Madsen
4e60c683b0
scaleup flag
2015-08-12 14:39:38 -04:00
Will Norris
396afb8a87
proxy non-200 responses with original status code
...
Some sites return a 404 image, and most browsers render them properly.
We should pass them along as well.
see also: atmos/camo#75 and atmos/camo#77
2015-05-15 22:33:03 -07:00
Will Norris
a9efefc8e7
add request signature support to Proxy
2015-05-14 15:30:07 -07:00
Will Norris
9d6f8fdf7d
refactor whitelist check in preparation for signature check
2015-05-14 15:30:06 -07:00
Will Norris
b1de3a9dd6
add String method to Request
2015-05-11 17:12:03 -07:00
Will Norris
ad54d71881
first pass at supporting a default base URL
...
this allows remote images to be specified as relative URLs, relative to
the `DefaultBaseURL` field. Fixes #15 .
2015-04-28 08:25:10 -07:00
Will Norris
dbac2f8063
log transform errors
2015-03-17 23:47:43 -07:00
Will Norris
2b84ef01ed
log requests and whether response is from cache
...
also make sure request body is always closed
fixes #17
2015-02-24 09:34:49 -08:00
Will Norris
1bf0515cef
be a little more precise in copying headers
...
it doesn't matter too much right now, given the headers that are being
copied, but this now makes sure that all header values get copied over
if multiple are present.
2015-02-20 23:52:52 -08:00
Will Norris
bf8d7a0cd8
copy original content-type from remote response
2015-02-20 13:05:31 -08:00
Will Norris
2e68caff67
more docs and rename TransformingTransport.Client
2014-11-26 16:49:48 -08:00
Will Norris
f476aa27c3
ignore favicon requests
2014-11-23 16:04:53 -08:00
Will Norris
2dd79ebd20
minor cleanup of error messages
...
- used same string for logging and error response to ensure they stay in
sync
- pass through any http error status codes from remote URLs
2014-11-21 17:59:51 -08:00
Will Norris
5a4e602373
small cleanup of check304 and add more tests
...
Remove unused ResponseWriter parameter from check304, add function docs,
and add TODO for alternate Etag header values that we should handle.
Add tests for Proxy.allowed and check304.
2014-11-21 07:51:19 -08:00
Will Norris
7994cb2cf6
handle error returned when fetching remote images
2014-11-19 22:22:21 -08:00
Will Norris
dae09a8c9d
rename proxy.go and remove old data package doc
2014-11-19 22:02:34 -08:00
Will Norris
a74e590181
restructure imageproxy package
...
- move binary from imageproxy.go to cmd/imageproxy/main.go
- move proxy package up to top level
2014-07-30 18:23:43 -07:00
Will Norris
919fdfbb78
relocate package to willnorris.com/go/imageproxy
2014-06-29 14:33:56 -07:00
Will Norris
c3eda83ab5
add default VERSION string
2013-12-26 13:55:52 -08:00
Will Norris
462b70dcc2
rename to 'imageproxy' (drop 'go-' prefix)
2013-12-26 11:14:28 -08:00
Will Norris
26dde07ec0
add -version flag and goxc build config
2013-12-26 11:00:50 -08:00
Will Norris
1db6456329
add cacheDir for specifying disk cache dir
2013-12-26 08:31:52 -08:00
Will Norris
73f6357cda
rely on httpcache for response caching
2013-12-26 08:31:52 -08:00
Will Norris
ea76f2d0d8
switch to Apache 2.0 license before release
2013-12-06 17:40:35 -08:00
Will Norris
036d0c51c4
allow setting max height and width
...
This is primarily added to prevent a denial of service attack where
insanely large images are requested, eating up CPU.
2013-12-06 14:17:39 -08:00
Will Norris
402e2c7d83
switch port flag to addr to allow specifying host
2013-12-04 03:58:26 -08:00
Will Norris
deaf0abd50
add whitelist of allowed remote hosts
2013-12-04 03:12:56 -08:00
Will Norris
95fdd8b79f
add basic caching support
...
includes two implementations, a no-op NopCache and an in-memory
MemoryCache.
2013-12-04 02:55:56 -08:00
Will Norris
11441a107a
add initial (pretty naive) server implementation
2013-11-27 14:45:46 -08:00