Skip to content

Instantly share code, notes, and snippets.

@JakeAustwick
Last active August 29, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JakeAustwick/10689478 to your computer and use it in GitHub Desktop.
Save JakeAustwick/10689478 to your computer and use it in GitHub Desktop.
Go 1.1.1 http bug
➜ domaincrawler go run bug.go
2014/04/15 00:17:00 Unsolicited response received on idle HTTP channel starting with "\x1f"; err=<nil>
2014/04/15 00:17:04 Unsolicited response received on idle HTTP channel starting with "\x1f"; err=<nil>
2014/04/15 00:17:07 Unsolicited response received on idle HTTP channel starting with "\x1f"; err=<nil>
2014/04/15 00:17:09 Unsolicited response received on idle HTTP channel starting with "\x1f"; err=<nil>
2014/04/15 00:17:11 Unsolicited response received on idle HTTP channel starting with "\x1f"; err=<nil>
2014/04/15 00:17:14 Unsolicited response received on idle HTTP channel starting with "\x1f"; err=<nil>
2014/04/15 00:17:16 Unsolicited response received on idle HTTP channel starting with "\x1f"; err=<nil>
➜ domaincrawler cat bug.go
package main
import (
"github.com/PuerkitoBio/gocrawl"
"github.com/PuerkitoBio/goquery"
// "log"
"net/http"
"time"
)
type ExampleExtender struct {
gocrawl.DefaultExtender // Will use the default implementation of all but Visit() and Filter()
}
func (this *ExampleExtender) Visit(ctx *gocrawl.URLContext, res *http.Response, doc *goquery.Document) (interface{}, bool) {
// log.Println(ctx.URL().String())
return nil, true
}
func main() {
opts := gocrawl.NewOptions(new(ExampleExtender))
opts.CrawlDelay = 1 * time.Second
// opts.LogFlags = gocrawl.LogTrace
opts.HeadBeforeGet = true
c := gocrawl.NewCrawlerWithOptions(opts)
c.Run("http://jakeaustwick.me")
}
@JakeAustwick
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment