Skip to content

Commit

Permalink
Merge branch 'prebid:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
garidepalli authored Nov 19, 2021
2 parents cca2a52 + 5e2d890 commit b47f2b2
Show file tree
Hide file tree
Showing 1,402 changed files with 75,358 additions and 27,869 deletions.
5 changes: 3 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
"build": {
"dockerfile": "Dockerfile",
"args": {
// Update the VARIANT arg to pick a version of Go: 1, 1.15, 1.14
"VARIANT": "1.14",
// Update the VARIANT arg to pick a version of Go
"VARIANT": "1.16",
// Options
"INSTALL_NODE": "false",
"NODE_VERSION": "lts/*",
}
},
"containerEnv": {
"GOPRIVATE": "${localEnv:GOPRIVATE}",
"PBS_GDPR_DEFAULT_VALUE": "0"
},
"runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validate-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.14.2
go-version: 1.16.4

- name: Checkout Merged Branch
uses: actions/checkout@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
validate:
strategy:
matrix:
go-version: [1.14.x, 1.15.x]
go-version: [1.15.x, 1.16.x]
os: [ubuntu-18.04]
runs-on: ${{ matrix.os }}

Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ RUN apt-get update && \
apt-get -y upgrade && \
apt-get install -y wget
RUN cd /tmp && \
wget https://dl.google.com/go/go1.14.2.linux-amd64.tar.gz && \
tar -xf go1.14.2.linux-amd64.tar.gz && \
wget https://dl.google.com/go/go1.16.4.linux-amd64.tar.gz && \
tar -xf go1.16.4.linux-amd64.tar.gz && \
mv go /usr/local
RUN mkdir -p /app/prebid-server/
WORKDIR /app/prebid-server/
Expand All @@ -20,7 +20,7 @@ RUN go mod vendor
RUN go mod tidy
ARG TEST="true"
RUN if [ "$TEST" != "false" ]; then ./validate.sh ; fi
RUN go build -mod=vendor .
RUN go build -mod=vendor -ldflags "-X github.com/prebid/prebid-server/version.Ver=`git describe --tags | sed 's/^v//'` -X github.com/prebid/prebid-server/version.Rev=`git rev-parse HEAD`" .

FROM ubuntu:18.04 AS release
LABEL maintainer="[email protected]"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Please consider [registering your Prebid Server](https://docs.prebid.org/prebid-

## Installation

First install [Go](https://golang.org/doc/install) version 1.14 or newer.
First install [Go](https://golang.org/doc/install) version 1.15 or newer.

Note that prebid-server is using [Go modules](https://blog.golang.org/using-go-modules).
We officially support the most recent two major versions of the Go runtime. However, if you'd like to use a version <1.13 and are inside GOPATH `GO111MODULE` needs to be set to `GO111MODULE=on`.
Expand Down
51 changes: 32 additions & 19 deletions adapters/33across/33across.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ type bidTtxExt struct {
func (a *TtxAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) {
var errs []error
var adapterRequests []*adapters.RequestData
var groupedImps = make(map[string][]openrtb2.Imp)

// Construct request extension common to all imps
// NOTE: not blocking adapter requests on errors
Expand All @@ -64,27 +65,39 @@ func (a *TtxAdapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapter
}
request.Ext = reqExt

// Break up multi-imp request into multiple external requests since we don't
// support SRA in our exchange server
// We only support SRA for requests containing same prod and
// zoneID, therefore group all imps accordingly and create a http
// request for each such group
for i := 0; i < len(request.Imp); i++ {
if adapterReq, err := a.makeRequest(*request, request.Imp[i]); err == nil {
adapterRequests = append(adapterRequests, adapterReq)
if impCopy, err := makeImps(request.Imp[i]); err == nil {
var impExt Ext

// Skip over imps whose extensions cannot be read since
// we cannot glean Prod or ZoneID which are required to
// group together. However let's not block request creation.
if err := json.Unmarshal(impCopy.Ext, &impExt); err == nil {
impKey := impExt.Ttx.Prod + impExt.Ttx.Zoneid
groupedImps[impKey] = append(groupedImps[impKey], impCopy)
} else {
errs = append(errs, err)
}
} else {
errs = append(errs, err)
}
}

for _, impList := range groupedImps {
if adapterReq, err := a.makeRequest(*request, impList); err == nil {
adapterRequests = append(adapterRequests, adapterReq)
} else {
errs = append(errs, err)
}
}
return adapterRequests, errs
}

func (a *TtxAdapter) makeRequest(request openrtb2.BidRequest, imp openrtb2.Imp) (*adapters.RequestData, error) {
impCopy, err := makeImps(imp)

if err != nil {
return nil, err
}

request.Imp = []openrtb2.Imp{*impCopy}
func (a *TtxAdapter) makeRequest(request openrtb2.BidRequest, impList []openrtb2.Imp) (*adapters.RequestData, error) {
request.Imp = impList

// Last Step
reqJSON, err := json.Marshal(request)
Expand All @@ -103,23 +116,23 @@ func (a *TtxAdapter) makeRequest(request openrtb2.BidRequest, imp openrtb2.Imp)
}, nil
}

func makeImps(imp openrtb2.Imp) (*openrtb2.Imp, error) {
func makeImps(imp openrtb2.Imp) (openrtb2.Imp, error) {
if imp.Banner == nil && imp.Video == nil {
return nil, &errortypes.BadInput{
return openrtb2.Imp{}, &errortypes.BadInput{
Message: fmt.Sprintf("Imp ID %s must have at least one of [Banner, Video] defined", imp.ID),
}
}

var bidderExt adapters.ExtImpBidder
if err := json.Unmarshal(imp.Ext, &bidderExt); err != nil {
return nil, &errortypes.BadInput{
return openrtb2.Imp{}, &errortypes.BadInput{
Message: err.Error(),
}
}

var ttxExt openrtb_ext.ExtImp33across
if err := json.Unmarshal(bidderExt.Bidder, &ttxExt); err != nil {
return nil, &errortypes.BadInput{
return openrtb2.Imp{}, &errortypes.BadInput{
Message: err.Error(),
}
}
Expand All @@ -135,7 +148,7 @@ func makeImps(imp openrtb2.Imp) (*openrtb2.Imp, error) {

impExtJSON, err := json.Marshal(impExt)
if err != nil {
return nil, &errortypes.BadInput{
return openrtb2.Imp{}, &errortypes.BadInput{
Message: err.Error(),
}
}
Expand All @@ -149,13 +162,13 @@ func makeImps(imp openrtb2.Imp) (*openrtb2.Imp, error) {
imp.Video = videoCopy

if err != nil {
return nil, &errortypes.BadInput{
return openrtb2.Imp{}, &errortypes.BadInput{
Message: err.Error(),
}
}
}

return &imp, nil
return imp, nil
}

func makeReqExt(request *openrtb2.BidRequest) ([]byte, error) {
Expand Down
200 changes: 0 additions & 200 deletions adapters/33across/33acrosstest/exemplary/multi-imp-banner.json

This file was deleted.

6 changes: 0 additions & 6 deletions adapters/33across/33acrosstest/params/race/banner.json

This file was deleted.

6 changes: 0 additions & 6 deletions adapters/33across/33acrosstest/params/race/video.json

This file was deleted.

Loading

0 comments on commit b47f2b2

Please sign in to comment.