Skip to content

Commit

Permalink
Optimize GPPSID array traversal (#2733)
Browse files Browse the repository at this point in the history
  • Loading branch information
guscarreon authored May 1, 2023
1 parent 7791306 commit e18f17f
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
1 change: 1 addition & 0 deletions endpoints/openrtb2/auction.go
Original file line number Diff line number Diff line change
Expand Up @@ -1708,6 +1708,7 @@ func validateRegs(req *openrtb_ext.RequestWrapper, gpp gpplib.GppContainer) []er
for _, id := range req.BidRequest.Regs.GPPSID {
if id == int8(constants.SectionTCFEU2) {
gdpr = 1
break
}
}
if gdpr != *req.BidRequest.Regs.GDPR {
Expand Down
5 changes: 5 additions & 0 deletions endpoints/openrtb2/auction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3590,6 +3590,11 @@ func TestAuctionWarnings(t *testing.T) {
file: "us-privacy-conflict.json",
expectedWarning: "regs.us_privacy consent does not match uspv1 in GPP, using regs.gpp",
},
{
name: "empty-gppsid-array-conflicts-with-regs-gdpr", // gdpr set to 1, an empty non-nil gpp_sid array doesn't match
file: "empty-gppsid-conflict.json",
expectedWarning: "regs.gdpr signal conflicts with GPP (regs.gpp_sid) and will be ignored",
},
{
name: "gdpr-signals-conflict", // gdpr signals do not match
file: "gdpr-conflict.json",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"description": "Well formed amp request with conflicting (2.6 gdpr consent vs. GPP) gdpr signals",
"mockBidRequest": {
"id": "b9c97a4b-cbc4-483d-b2c4-58a19ed5cfc5",
"site": {
"page": "prebid.org",
"publisher": {
"id": "a3de7af2-a86a-4043-a77b-c7e86744155e"
}
},
"source": {
"tid": "b9c97a4b-cbc4-483d-b2c4-58a19ed5cfc5"
},
"tmax": 1000,
"imp": [
{
"id": "/19968336/header-bid-tag-0",
"ext": {
"appnexus": {
"placementId": 12883451
}
},
"banner": {
"format": [
{
"w": 300,
"h": 250
},
{
"w": 300,
"h": 300
}
]
}
}
],
"regs": {
"gpp": "DBACNYA~CPXxRfAPXxRfAAfKABENB-CgAAAAAAAAAAYgAAAAAAAA~1NYN",
"gpp_sid": [ ],
"gdpr": 1,
"ext": {
"us_privacy": "1YYY"
}
},
"user": {
"consent": "CPXxRfAPXxRfAAfKABENB-CgAAAAAAAAAAYgAAAAAAAA",
"ext": {}
}
},
"expectedBidResponse": {
"id":"b9c97a4b-cbc4-483d-b2c4-58a19ed5cfc5",
"bidid":"test bid id",
"nbr":0
},
"expectedReturnCode": 200
}

0 comments on commit e18f17f

Please sign in to comment.