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:
		
							parent
							
								
									d75008a34f
								
							
						
					
					
						commit
						4d7c036acc
					
				@ -61,7 +61,7 @@ def ingress_request(
 | 
				
			|||||||
        log.debug(f"Linked to service {service}")
 | 
					        log.debug(f"Linked to service {service}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if dnt and service.respect_dnt:
 | 
					        if dnt and service.respect_dnt:
 | 
				
			||||||
            log.debug("Ignoring because of DNT")
 | 
					            log.debug("Ignoring because of DNT or GPC")
 | 
				
			||||||
            return
 | 
					            return
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
 | 
				
			|||||||
@ -29,6 +29,9 @@ def ingress(request, service_uuid, identifier, tracker, payload):
 | 
				
			|||||||
    location = request.META.get("HTTP_REFERER", "").strip()
 | 
					    location = request.META.get("HTTP_REFERER", "").strip()
 | 
				
			||||||
    user_agent = request.META.get("HTTP_USER_AGENT", "").strip()
 | 
					    user_agent = request.META.get("HTTP_USER_AGENT", "").strip()
 | 
				
			||||||
    dnt = request.META.get("HTTP_DNT", "0").strip() == "1"
 | 
					    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(
 | 
					    ingress_request.delay(
 | 
				
			||||||
        service_uuid,
 | 
					        service_uuid,
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user