Skip to content

Commit 2c5f6ed

Browse files
committed
Merge pull request justquick#12 from jaddison/master
Two PURGE issues addressed
2 parents 93f0823 + 721e43a commit 2c5f6ed

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

varnish.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ def http_purge_url(url):
5151
"""
5252
url = urlparse(url)
5353
connection = HTTPConnection(url.hostname, url.port or 80)
54-
connection.request('PURGE', '%s?%s' % (url.path or '/', url.query), '',
55-
{'Host': url.hostname})
54+
path = url.path or '/'
55+
connection.request('PURGE', '%s?%s' % (path, url.query) if url.query else path, '',
56+
{'Host': '%s:%s' % (url.hostname, url.port) if url.port else url.hostname})
5657
response = connection.getresponse()
5758
if response.status != 200:
5859
logging.error('Purge failed with status: %s' % response.status)

0 commit comments

Comments
 (0)