Add support for GPC header (#219)

* chore: reflect both headers in debugging

* chore: add Sec-GPC handling with DNT handling

The `if` statement is there purely so that nothing more has to change handling wise. If either value is true, DNT policy should kick in and no data should be stored/tracked. *Should* just work™.

* fix: meet Black style guide

* fix: comply with other header formatting

* fix: header typo
This commit is contained in:
Matt Ronchetto 2022-08-27 18:35:56 -07:00 committed by GitHub
parent d75008a34f
commit 4d7c036acc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View File

@ -61,7 +61,7 @@ def ingress_request(
log.debug(f"Linked to service {service}")
if dnt and service.respect_dnt:
log.debug("Ignoring because of DNT")
log.debug("Ignoring because of DNT or GPC")
return
try:

View File

@ -29,6 +29,9 @@ def ingress(request, service_uuid, identifier, tracker, payload):
location = request.META.get("HTTP_REFERER", "").strip()
user_agent = request.META.get("HTTP_USER_AGENT", "").strip()
dnt = request.META.get("HTTP_DNT", "0").strip() == "1"
gpc = request.META.get("HTTP_SEC_GPC", "0").strip() == "1"
if gpc or dnt:
dnt = True
ingress_request.delay(
service_uuid,