Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
Merge pull request #876 from mozilla-services/feat/875
Browse files Browse the repository at this point in the history
feat: add tracking for content-encoding
  • Loading branch information
pjenvey authored Apr 20, 2017
2 parents 5efe75c + c236f72 commit 0ef8563
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions autopush/tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,9 @@ def test_webpush_data_delivery_to_connected_client(self):
eq_(result["data"], "wyigoeIooQ")
ok_(self.logs.logged_ci(lambda ci: 'message_size' in ci),
"message_size not logged")
ok_(self.logs.logged_ci(
lambda ci: ci['encoding'] == "aesgcm"
))
yield self.shut_down(client)

@inlineCallbacks
Expand Down
7 changes: 5 additions & 2 deletions autopush/web/webpush.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,16 +411,19 @@ def post(self,
self._client_info["jwt_" + i] = jwt["jwt_data"][i]

user_data = subscription["user_data"]
encoding = ''
if notification.data and notification.headers:
encoding = notification.headers.get('encoding', '')
self._client_info.update(
message_id=notification.message_id,
uaid=hasher(user_data.get("uaid")),
channel_id=user_data.get("chid"),
router_key=user_data["router_type"],
message_size=len(notification.data or ""),
ttl=notification.ttl,
version=notification.version
version=notification.version,
encoding=encoding,
)

router = self.ap_settings.routers[user_data["router_type"]]
self._router_time = time.time()
d = maybeDeferred(router.route_notification, notification, user_data)
Expand Down

0 comments on commit 0ef8563

Please sign in to comment.