Skip to content

Commit

Permalink
[enh] provide default URL scheme
Browse files Browse the repository at this point in the history
closes #23
  • Loading branch information
asciimoo committed Oct 12, 2017
1 parent 5e31f9b commit d1a65d3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion colly.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,13 @@ func (c *Collector) scrape(u, method string, depth int, requestData io.Reader, c
if err != nil {
return err
}
if parsedURL.Scheme == "" {
parsedURL.Scheme = "http"
}
if !c.isDomainAllowed(parsedURL.Host) {
return errors.New("Forbidden domain")
}
req, err := http.NewRequest(method, u, requestData)
req, err := http.NewRequest(method, parsedURL.String(), requestData)
if err != nil {
return err
}
Expand Down

0 comments on commit d1a65d3

Please sign in to comment.