@ -24,6 +24,7 @@ var (
listenAddr = flag . String ( "addr" , "127.0.0.1:8889" , "listen address" )
cacheDir = flag . String ( "cachedir" , "/tmp" , "absolute cache dir" )
maxFileSize = flag . Int64 ( "maxfilesize" , 1 << 23 , "refuse to handle files larger than this, in bytes" )
minCacheAge = flag . Uint ( "mincacheage" , 3600 , "min cache-control max-age value, in seconds" )
idleRelayTimeout = flag . Duration ( "idlerelaytimeout" , 10 * time . Minute , "remove relay connections after idling this long" )
showVersion = flag . Bool ( "V" , false , "print version and exit" )
@ -164,6 +165,7 @@ func handleMeta(w http.ResponseWriter, r *http.Request) {
Images : meta . ImageURLs ,
}
w . Header ( ) . Set ( "Content-Type" , "application/json" )
w . Header ( ) . Set ( "Cache-Control" , fmt . Sprintf ( "max-age=%d" , * minCacheAge ) )
json . NewEncoder ( w ) . Encode ( res )
}
@ -183,6 +185,7 @@ func handleData(w http.ResponseWriter, r *http.Request) {
}
defer ds . Close ( )
w . Header ( ) . Set ( "Content-Type" , ds . ContentType )
w . Header ( ) . Set ( "Cache-Control" , fmt . Sprintf ( "max-age=%d" , * minCacheAge ) )
io . Copy ( w , ds )
}