Skip to content

Commit

Permalink
Merge pull request gocolly#262 from qianlei90/patch-1
Browse files Browse the repository at this point in the history
fix proxy url empty when response error
  • Loading branch information
asciimoo authored Jan 21, 2019
2 parents d287135 + 7e95155 commit 85daab4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions colly.go
Original file line number Diff line number Diff line change
Expand Up @@ -596,16 +596,16 @@ func (c *Collector) fetch(u, method string, depth int, requestData io.Reader, ct

origURL := req.URL
response, err := c.backend.Cache(req, c.MaxBodySize, c.CacheDir)
if proxyURL, ok := req.Context().Value(ProxyURLKey).(string); ok {
request.ProxyURL = proxyURL
}
if err := c.handleOnError(response, err, request, ctx); err != nil {
return err
}
if req.URL != origURL {
request.URL = req.URL
request.Headers = &req.Header
}
if proxyURL, ok := req.Context().Value(ProxyURLKey).(string); ok {
request.ProxyURL = proxyURL
}
atomic.AddUint32(&c.responseCount, 1)
response.Ctx = ctx
response.Request = request
Expand Down

0 comments on commit 85daab4

Please sign in to comment.