writeTo replays the captured origin response onto w. Any header the origin set that isn't a hop-by-hop is forwarded; status code and body follow.
(w http.ResponseWriter)
| 635 | if backoff <= 0 { |
| 636 | return 0 |
| 637 | } |
| 638 | if maxBackoff > 0 && backoff > maxBackoff { |
| 639 | backoff = maxBackoff |
| 640 | } |
| 641 | return time.Duration(float64(backoff) * (0.5 + rand.Float64()*0.5)) |
| 642 | } |
| 643 | |
| 644 | func (p *CacheProxy) fetchOriginOnce(cacheKey string, r *http.Request) (int64, string, error) { |
| 645 | timeout := p.originTimeout |
| 646 | if timeout <= 0 { |
| 647 | timeout = defaultOriginTimeout |
| 648 | } |
| 649 | ctx, cancel := context.WithTimeout(r.Context(), timeout) |
| 650 | defer cancel() |
| 651 |
no test coverage detected