mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 01:32:36 +02:00
cache purge: retry once with URI.encode
This commit is contained in:
parent
d31655d73f
commit
2a451e1eec
1 changed files with 8 additions and 0 deletions
|
@ -18,11 +18,19 @@ class PurgeCacheWorker
|
|||
"http://#{proxy_ip}#{path}",
|
||||
Addressable::URI::CharacterClasses::QUERY
|
||||
)
|
||||
|
||||
retry_encoded = false
|
||||
|
||||
begin
|
||||
RestClient::Request.execute method: :head, url: url, timeout: HTTP_TIMEOUT, headers: {
|
||||
host: URI::encode("#{username}.neocities.org"),
|
||||
cache_purge: '1'
|
||||
}
|
||||
rescue URI::InvalidURIError
|
||||
raise if retry_encoded == true
|
||||
url = URI.encode url
|
||||
retry_encoded = true
|
||||
retry
|
||||
rescue RestClient::ResourceNotFound
|
||||
rescue RestClient::Forbidden
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue