HandlePeerHas responds to "do you have this cache key?" from peers.
(w http.ResponseWriter, r *http.Request)
| 773 | msg := strings.ToLower(err.Error()) |
| 774 | switch { |
| 775 | case strings.Contains(msg, "connection reset by peer"): |
| 776 | return "connection_reset" |
| 777 | case strings.Contains(msg, "connection refused"): |
| 778 | return "connection_refused" |
| 779 | case strings.Contains(msg, "unexpected eof"): |
| 780 | return "unexpected_eof" |
| 781 | case strings.Contains(msg, "timeout"): |
| 782 | return "timeout" |
| 783 | default: |
| 784 | return "transport_error" |
| 785 | } |
| 786 | } |
| 787 | |
| 788 | // originErrorBodyCap is the maximum number of bytes we'll buffer from a |
| 789 | // non-2xx origin response. S3 XML error envelopes are tiny; this is just a |