Skip to content
This repository has been archived by the owner before Nov 9, 2022. It is now read-only.

lox/httpcache

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
cli
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

httpcache

httpcache provides an rfc7234 compliant golang http.Handler.

wercker status

GoDoc

Example

This example is from the included CLI, it runs a caching proxy on http://localhost:8080.

proxy := &httputil.ReverseProxy{
    Director: func(r *http.Request) {
    },
}

handler := httpcache.NewHandler(httpcache.NewMemoryCache(), proxy)
handler.Shared = true

log.Printf("proxy listening on http://%s", listen)
log.Fatal(http.ListenAndServe(listen, handler))

Implemented

  • All of rfc7234, except those listed below
  • Disk and Memory storage
  • Apache-like logging via httplog package

Todo

  • Offline operation
  • Size constraints on memory/disk cache and cache eviction
  • Correctly handle mixture of HTTP1.0 clients and 1.1 upstreams
  • More detail in Via header
  • Support for weak entities with If-Match and If-None-Match
  • Invalidation based on Content-Location and request method
  • Better handling of duplicate headers and CacheControl values

Caveats

  • Conditional requests are never cached, this includes Range requests

Testing

Tests are currently conducted via the test suite and verified via the CoAdvisor tool.

Reading List

About

An RFC7234 compliant golang http.Handler for caching HTTP responses

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages