Skip to content

Commit 928dfeb

Browse files
authored
Merge pull request #9 from web-push-libs/bug/8
bug: append vapid and encryption headers with a ';'
2 parents 34c7a88 + a450f68 commit 928dfeb

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

pywebpush/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,10 @@ def send(self, data, headers={}, ttl=0, gcm_key=None, reg_id=None):
172172
headers = CaseInsensitiveDict(headers)
173173
crypto_key = headers.get("crypto-key", "")
174174
if crypto_key:
175-
crypto_key += ','
175+
# due to some confusion by a push service provider, we should
176+
# use ';' instead of ',' to append the headers.
177+
# see https://github.com/webpush-wg/webpush-encryption/issues/6
178+
crypto_key += ';'
176179
crypto_key += "keyid=p256dh;dh=" + encoded["crypto_key"].decode('utf8')
177180
headers.update({
178181
'crypto-key': crypto_key,

pywebpush/tests/test_webpush.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ def test_send(self, mock_post):
106106
ok_('encryption' in pheaders)
107107
eq_(pheaders.get('AUTHENTICATION'), headers.get('Authentication'))
108108
ckey = pheaders.get('crypto-key')
109-
ok_('pre-existing,' in ckey)
109+
ok_('pre-existing' in ckey)
110110
eq_(pheaders.get('content-encoding'), 'aesgcm')
111111

112112
def test_ci_dict(self):

0 commit comments

Comments
 (0)