Ignore HTTPS errors

This commit is contained in:
Richard Patel 2018-11-18 00:37:30 +01:00
parent 4464f34779
commit 6793086c22
No known key found for this signature in database
GPG Key ID: C268B2BBDA2ABECB
4 changed files with 12 additions and 11 deletions

View File

@ -14,7 +14,7 @@ var config struct {
Token string
ServerTimeout time.Duration
Recheck time.Duration
ChunkSize uint
ChunkSize int64
Retries int
Workers int
Timeout time.Duration
@ -78,7 +78,7 @@ func readConfig() {
config.Recheck = viper.GetDuration(ConfRecheck)
config.ChunkSize = viper.GetSizeInBytes(ConfChunkSize)
config.ChunkSize = int64(viper.GetSizeInBytes(ConfChunkSize))
if config.ChunkSize < 100 {
configOOB(ConfChunkSize, config.ChunkSize)
}

View File

@ -2,6 +2,7 @@ package main
import (
"bytes"
"crypto/tls"
"github.com/terorie/od-database-crawler/ds/redblackhash"
"github.com/terorie/od-database-crawler/fasturl"
"github.com/valyala/fasthttp"
@ -13,7 +14,11 @@ import (
"time"
)
var client fasthttp.Client
var client = fasthttp.Client {
TLSConfig: &tls.Config{
InsecureSkipVerify: true,
},
}
func GetDir(j *Job, f *File) (links []fasturl.URL, err error) {
f.IsDir = true

View File

@ -148,6 +148,6 @@ func cmdCrawler(clic *cli.Context) error {
}
var buildDate = time.Date(
2018, 11, 15,
23, 24, 0, 0,
2018, 11, 17,
23, 32, 0, 0,
time.UTC)

View File

@ -13,10 +13,6 @@ import (
"strconv"
)
const (
fileListChunkSize int64 = 5000000 // 5 mb
)
var serverClient = http.Client {
Timeout: config.ServerTimeout,
}
@ -90,11 +86,11 @@ func uploadChunks(websiteId uint64, f *os.File) error {
// Copy chunk to file_list
formFile, err := multi.CreateFormFile("file_list", "file_list")
var n int64
n, err = io.CopyN(formFile, f, fileListChunkSize)
n, err = io.CopyN(formFile, f, config.ChunkSize)
if err != io.EOF && err != nil {
return err
}
if n < fileListChunkSize {
if n < config.ChunkSize {
err = nil
// Break at end of iteration
eof = true