mirror of
https://github.com/MontFerret/ferret.git
synced 2025-01-16 03:21:03 +02:00
added back allowedHTTPCodes function
This commit is contained in:
parent
d0a3218b9a
commit
cdc6573d0f
@ -152,7 +152,7 @@ func (drv *Driver) Open(ctx context.Context, params drivers.Params) (drivers.HTM
|
||||
|
||||
defer resp.Body.Close()
|
||||
|
||||
if _, exists := drv.options.AllowedHTTPCodes[resp.StatusCode]; !exists {
|
||||
if !drv.responseCodeAllowed(resp) {
|
||||
return nil, errors.New(resp.Status)
|
||||
}
|
||||
|
||||
@ -177,6 +177,11 @@ func (drv *Driver) Open(ctx context.Context, params drivers.Params) (drivers.HTM
|
||||
return NewHTMLPage(doc, params.URL, &r, cookies)
|
||||
}
|
||||
|
||||
func (drv *Driver) responseCodeAllowed(resp *http.Response) bool {
|
||||
_, exists := drv.options.AllowedHTTPCodes[resp.StatusCode]
|
||||
return exists
|
||||
}
|
||||
|
||||
func (drv *Driver) Parse(_ context.Context, str values.String) (drivers.HTMLPage, error) {
|
||||
buf := bytes.NewBuffer([]byte(str))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user