初始化
This commit is contained in:
@ -1,8 +1,8 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"github.com/geziyor/geziyor/client"
|
||||
"github.com/geziyor/geziyor/internal"
|
||||
"softdown.com/shusou/geziyor/client"
|
||||
"softdown.com/shusou/geziyor/internal"
|
||||
"sync"
|
||||
)
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"github.com/geziyor/geziyor/client"
|
||||
"math/rand"
|
||||
"softdown.com/shusou/geziyor/client"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"github.com/geziyor/geziyor/client"
|
||||
"github.com/geziyor/geziyor/internal"
|
||||
"softdown.com/shusou/geziyor/client"
|
||||
"softdown.com/shusou/geziyor/internal"
|
||||
"sync"
|
||||
)
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"github.com/geziyor/geziyor/client"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"softdown.com/shusou/geziyor/client"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
@ -1,7 +1,7 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"github.com/geziyor/geziyor/client"
|
||||
"softdown.com/shusou/geziyor/client"
|
||||
)
|
||||
|
||||
// Headers sets default request headers
|
||||
|
@ -1,8 +1,8 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"github.com/geziyor/geziyor/client"
|
||||
"github.com/geziyor/geziyor/internal"
|
||||
"softdown.com/shusou/geziyor/client"
|
||||
"softdown.com/shusou/geziyor/internal"
|
||||
)
|
||||
|
||||
// LogStats logs responses
|
||||
|
@ -1,8 +1,8 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"github.com/geziyor/geziyor/client"
|
||||
"github.com/geziyor/geziyor/metrics"
|
||||
"softdown.com/shusou/geziyor/client"
|
||||
"softdown.com/shusou/geziyor/metrics"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"github.com/geziyor/geziyor/client"
|
||||
"softdown.com/shusou/geziyor/client"
|
||||
)
|
||||
|
||||
// RequestResponseProcessor interface is for middlewares that needs to process both requests and responses
|
||||
|
@ -3,8 +3,8 @@ package middleware
|
||||
import (
|
||||
"bytes"
|
||||
"github.com/PuerkitoBio/goquery"
|
||||
"github.com/geziyor/geziyor/client"
|
||||
"github.com/geziyor/geziyor/internal"
|
||||
"softdown.com/shusou/geziyor/client"
|
||||
"softdown.com/shusou/geziyor/internal"
|
||||
)
|
||||
|
||||
// ParseHTML parses response if response is HTML
|
||||
|
@ -1,10 +1,11 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"github.com/geziyor/geziyor/client"
|
||||
"github.com/geziyor/geziyor/internal"
|
||||
"github.com/geziyor/geziyor/metrics"
|
||||
"github.com/temoto/robotstxt"
|
||||
"net/http"
|
||||
"softdown.com/shusou/geziyor/client"
|
||||
"softdown.com/shusou/geziyor/internal"
|
||||
"softdown.com/shusou/geziyor/metrics"
|
||||
"strconv"
|
||||
"sync"
|
||||
)
|
||||
@ -38,7 +39,7 @@ func (m *RobotsTxt) ProcessRequest(r *client.Request) {
|
||||
m.mut.RUnlock()
|
||||
|
||||
if !exists {
|
||||
robotsReq, err := client.NewRequest("GET", r.URL.Scheme+"://"+r.Host+"/robots.txt", nil)
|
||||
robotsReq, err := client.NewRequest(http.MethodGet, r.URL.Scheme+"://"+r.Host+"/robots.txt", "", nil)
|
||||
if err != nil {
|
||||
return // Don't Do anything
|
||||
}
|
||||
|
Reference in New Issue
Block a user