"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "pkg/geoipupdate/database/http_reader.go" between
geoipupdate-4.1.5.tar.gz and geoipupdate-4.2.0.tar.gz

About: GeoIP Update performs automatic updates of GeoIP2 and GeoIP Legacy binary databases (MaxMind). Release 4.x (written now in Go).

http_reader.go  (geoipupdate-4.1.5):http_reader.go  (geoipupdate-4.2.0)
skipping to change at line 13 skipping to change at line 13
import ( import (
"compress/gzip" "compress/gzip"
"fmt" "fmt"
"io" "io"
"io/ioutil" "io/ioutil"
"log" "log"
"net/http" "net/http"
"net/url" "net/url"
"time" "time"
"github.com/maxmind/geoipupdate/pkg/geoipupdate" "github.com/maxmind/geoipupdate/v4/pkg/geoipupdate"
"github.com/pkg/errors" "github.com/pkg/errors"
) )
// HTTPDatabaseReader is a Reader that uses an HTTP client to retrieve // HTTPDatabaseReader is a Reader that uses an HTTP client to retrieve
// databases. // databases.
type HTTPDatabaseReader struct { type HTTPDatabaseReader struct {
client *http.Client client *http.Client
url string url string
licenseKey string licenseKey string
accountID int accountID int
skipping to change at line 61 skipping to change at line 61
"%s/geoip/databases/%s/update?db_md5=%s", "%s/geoip/databases/%s/update?db_md5=%s",
reader.url, reader.url,
url.PathEscape(editionID), url.PathEscape(editionID),
url.QueryEscape(destination.GetHash()), url.QueryEscape(destination.GetHash()),
) )
req, err := http.NewRequest(http.MethodGet, maxMindURL, nil) req, err := http.NewRequest(http.MethodGet, maxMindURL, nil)
if err != nil { if err != nil {
return errors.Wrap(err, "error creating request") return errors.Wrap(err, "error creating request")
} }
if reader.accountID != 0 { req.SetBasicAuth(fmt.Sprintf("%d", reader.accountID), reader.licenseKey)
req.SetBasicAuth(fmt.Sprintf("%d", reader.accountID), reader.lice
nseKey)
}
if reader.verbose { if reader.verbose {
log.Printf("Performing update request to %s", maxMindURL) log.Printf("Performing update request to %s", maxMindURL)
} }
response, err := reader.client.Do(req) response, err := reader.client.Do(req)
if err != nil { if err != nil {
return errors.Wrap(err, "error performing HTTP request") return errors.Wrap(err, "error performing HTTP request")
} }
defer func() { defer func() {
if err := response.Body.Close(); err != nil { if err := response.Body.Close(); err != nil {
 End of changes. 2 change blocks. 
5 lines changed or deleted 2 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)