Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • gitlab-org/gitlab-pages
  • rfwatson/gitlab-pages
  • masakura/gitlab-pages
  • gordio/gitlab-pages
  • zloster/gitlab-pages
  • jonnymbgood/gitlab-pages
  • shinya.maeda/gitlab-pages
  • xer0x/gitlab-pages
  • esabelhaus/gitlab-pages
  • frolvlad/gitlab-pages
  • mgresko/gitlab-pages
  • fzipi/gitlab-pages
  • naysayer1/gitlab-pages
  • yaowenli/gitlab-pages
  • tuomoa/gitlab-pages
  • ahodgen/gitlab-pages
  • techonomics_/gitlab-pages
  • icode1/gitlab-pages
  • Maritonette/gitlab-pages
  • uros.simovic/gitlab-pages
  • randallscott99/gitlab-pages
  • nolith/gitlab-pages
  • Ww3.Google.com/gitlab-pages
  • Ambyjkl/gitlab-pages
  • pknw1/gitlab-pages
  • macstacks/gitlab-pages
  • lpasselin/gitlab-pages
  • itoijala/gitlab-pages
  • JonathonReinhart/gitlab-pages
  • Azaradel/gitlab-pages
  • fundasecgin32/gitlab-pages
  • BageDevimo/gitlab-pages
  • jmkim/gitlab-pages
  • siemens/gitlab-pages
  • tardyp/gitlab-pages
  • michaels3d/gitlab-pages
  • tuxillo/gitlab-pages
  • karrick/gitlab-pages
  • sca_gitlab/gitlab-pages
  • alerque/gitlab-pages
  • unaheidi/gitlab-pages
  • maryomotayo2/gitlab-pages
  • liuzyhn/gitlab-pages
  • xingdi25/gitlab-pages
  • chefashiful.islam/gitlab-pages
  • johan.ramirez/gitlab-pages
  • Laurenslill/gitlab-pages
  • yigithankardas/gitlab-pages
  • leolara/gitlab-pages
  • nuwe1/gitlab-pages
  • GoroD/gitlab-pages
  • PopeDrFreud/gitlab-pages
  • hemanthdev/gitlab-pages
  • ba2014sheer/gitlab-pages
  • NicoleS021/gitlab-pages
  • boboso1971/gitlab-pages
  • mark2472-repos/gitlab-pages
  • derekmiller111978.dm/gitlab-pages
  • 229083520/gitlab-pages
  • armbiant/gitlab-pages
  • 358253885/gitlab-pages
  • seavhong0001/gitlab-pages
  • ashimtriv/gitlab-pages
  • ayushontop/gitlab-pages
  • jaime/gitlab-pages
  • sdwolfz/gitlab-pages
  • mipmip/gitlab-pages
  • ksashikumar/gitlab-pages
  • poppygo/gitlab-pages
  • xmarlem/gitlab-pages
  • realFlowControl/gitlab-pages
  • feistel/gitlab-pages
  • Shefali321/gitlab-pages
  • we88c0de/gitlab-pages
  • sathieu/gitlab-pages
  • bhuvantmey/gitlab-pages
  • kevin.kengne1/gitlab-pages
  • Dishon/gitlab-pages
  • ljdo.lj/gitlab-pages
  • ercan.ucan/gitlab-pages
  • davidleger95/gitlab-pages
  • jenslauterbach/gitlab-pages
  • kinohub1/gitlab-pages
  • psykomal/gitlab-pages
  • d.esterman/gitlab-pages
  • nfriend/gitlab-pages
  • ax10336/gitlab-pages
  • bhiseviraj/gitlab-pages
  • Virajbhise/gitlab-pages
  • nikovega21/gitlab-pages
  • HaroldKnowlden/gitlab-pages
  • mlegner/gitlab-pages
  • lenharo/gitlab-pages
  • danscott/gitlab-pages
  • Kolan92/gitlab-pages
  • HuseyinEmreAksoy/gitlab-pages
  • test_jaime/gitlab-pages
  • Osmanilge/gitlab-pages
  • cs-ic/gitlab-pages
  • TamerlanG1/gitlab-pages
  • aravind.mylsamy/gitlab-pages
  • quiqr/gitlab-pages
  • andrew.c3/gitlab-pages
  • altiayirem/gitlab-pages
  • sayeedahmad/gitlab-pages
  • chriscrabtree2021/gitlab-pages
  • leshkatruhachev/gitlab-pages
  • l.dijkman/gitlab-pages
  • casfahrenfort/gitlab-pages
  • dtjdtrj/gitlab-pages
  • kevin.rojas/wr-gitlab-pages
  • gitlab-renovate-forks/gitlab-pages
  • slumericanbds1/gitlab-pages
  • ayuryshev/gitlab-pages
  • abitrolly/gitlab-pages
  • sitedata/gitlab-pages
  • tidys/gitlab-pages
  • Mohamad.Elsuity/gitlab-pages
  • principallksk/gitlab-pages
  • gitlab-community/gitlab-pages
  • rafaelgamboatumtum/gitlab-pages
  • armbiant/gnome-gitlab-pages
  • ollevche/gitlab-pages
  • xMoelletschi/gitlab-pages
124 results
Show changes
Commits on Source (24)
## 16.2.1 (2023-07-25)
No changes.
## 16.2.0 (2023-07-21)
No changes.
## 16.1.2 (2023-07-04)
No changes.
## 16.1.1 (2023-06-28)
No changes.
## 16.1.0 (2023-06-21)
### Other (1 change)
- [Upgrade golang.org/x/crypto](gitlab-org/gitlab-pages@8817859a9392d0a96b7d3420c5f3e2fb8471b5cd) ([merge request](gitlab-org/gitlab-pages!873))
## 16.0.7 (2023-07-04)
No changes.
## 16.0.6 (2023-06-28)
No changes.
## 16.0.5 (2023-06-16)
No changes.
## 16.0.4 (2023-06-08)
No changes.
......@@ -18,6 +52,22 @@ No changes.
No changes.
## 15.11.12 (2023-07-14)
No changes.
## 15.11.11 (2023-07-04)
No changes.
## 15.11.10 (2023-06-28)
No changes.
## 15.11.9 (2023-06-15)
No changes.
## 15.11.8 (2023-06-06)
No changes.
......
......@@ -31,7 +31,7 @@ _This notice should stay as the first item in the CONTRIBUTING.md file._
- [Subject labels (~wiki, ~"container registry", ~ldap, ~api, etc.)](#subject-labels-wiki-container-registry-ldap-api-etc)
- [Team labels (~CI, ~Discussion, ~Edge, ~Platform, etc.)](#team-labels-ci-discussion-edge-platform-etc)
- [Priority labels (~Deliverable and ~Stretch)](#priority-labels-deliverable-and-stretch)
- [Label for community contributors (~"Accepting Merge Requests")](#label-for-community-contributors-accepting-merge-requests)
- [Label for community contributors (~"Seeking community contributions")](#label-for-community-contributors-seeking-community-contributions)
- [Implement design & UI elements](#implement-design--ui-elements)
- [Issue tracker](#issue-tracker)
- [Issue triaging](#issue-triaging)
......@@ -107,7 +107,7 @@ the remaining issues on the GitHub issue tracker.
## I want to contribute!
If you want to contribute to GitLab, but are not sure where to start,
look for [issues with the label `Accepting Merge Requests` and weight < 5][accepting-mrs-weight].
look for [issues with the label `Seeking community contributions` and weight < 5][seeking-contributions-weight].
These issues will be of reasonable size and challenge, for anyone to start
contributing to GitLab.
......@@ -192,14 +192,14 @@ release. There are two levels of priority labels:
milestone. If these issues are not done in the current release, they will
strongly be considered for the next release.
### Label for community contributors (~"Accepting Merge Requests")
### Label for community contributors (~"Seeking community contributions")
Issues that are beneficial to our users, 'nice to haves', that we currently do
not have the capacity for or want to give the priority to, are labeled as
~"Accepting Merge Requests", so the community can make a contribution.
~"Seeking community contributions", so the community can make a contribution.
Community contributors can submit merge requests for any issue they want, but
the ~"Accepting Merge Requests" label has a special meaning. It points to
the ~"Seeking community contributions" label has a special meaning. It points to
changes that:
1. We already agreed on,
......@@ -207,11 +207,11 @@ changes that:
1. Are likely to get accepted by a maintainer.
We want to avoid a situation when a contributor picks an
~"Accepting Merge Requests" issue and then their merge request gets closed,
~"Seeking community contributions" issue and then their merge request gets closed,
because we realize that it does not fit our vision, or we want to solve it in a
different way.
We add the ~"Accepting Merge Requests" label to:
We add the ~"Seeking community contributions" label to:
- Low priority ~bug issues (i.e. we do not add it to the bugs that we want to
solve in the ~"Next Patch Release")
......@@ -219,18 +219,17 @@ solve in the ~"Next Patch Release")
the ~UX / ~"Product work" is already done
- Small ~"technical debt" issues
After adding the ~"Accepting Merge Requests" label, we try to estimate the
After adding the ~"Seeking community contributions" label, we try to estimate the
[weight](#issue-weight) of the issue. We use issue weight to let contributors
know how difficult the issue is. Additionally:
- We advertise [~"Accepting Merge Requests" issues with weight < 5][up-for-grabs]
- We advertise [~"Seeking community contributions" issues with weight < 5][seeking-contributions-weight]
as suitable for people that have never contributed to GitLab before on the
[Up For Grabs campaign](http://up-for-grabs.net)
- We encourage people that have never contributed to any open source project to
look for [~"Accepting Merge Requests" issues with a weight of 1][firt-timers]
look for [~"Seeking community contributions" issues with a weight of 1][first-timers]
[up-for-grabs]: https://gitlab.com/gitlab-org/gitlab-pages/issues?label_name=Accepting+Merge+Requests&scope=all&sort=weight_asc&state=opened
[firt-timers]: https://gitlab.com/gitlab-org/gitlab-pages/issues?label_name%5B%5D=Accepting+Merge+Requests&scope=all&sort=upvotes_desc&state=opened&weight=1
[first-timers]: https://gitlab.com/gitlab-org/gitlab-pages/-/issues/?sort=popularity&state=opened&weight=1&label_name%5B%5D=Seeking%20community%20contributions
## Implement design & UI elements
......@@ -382,7 +381,7 @@ A recent example of this was the issue for
We welcome merge requests with fixes and improvements to GitLab code, tests,
and/or documentation. The issues that are specifically suitable for
community contributions are listed with the label
[`Accepting Merge Requests` on our issue tracker for Pages][accepting-mrs],
[`Seeking community contributions` on our issue tracker for Pages][seeking-community-contributions],
but you are free to contribute to any other issue you want.
Please note that if an issue is marked for the current milestone either before
......@@ -391,7 +390,7 @@ in order to ensure the work is finished before the release date.
If you want to add a new feature that is not labeled it is best to first create
a feedback issue (if there isn't one already) and leave a comment asking for it
to be marked as `Accepting Merge Requests`. Please include screenshots or
to be marked as `Seeking community contributions`. Please include screenshots or
wireframes if the feature will also change the UI.
Merge requests should be opened at [GitLab.com][pages-mr-tracker].
......@@ -585,12 +584,12 @@ available at [http://contributor-covenant.org/version/1/1/0/](http://contributor
[team]: https://about.gitlab.com/team/
[getting-help]: https://about.gitlab.com/getting-help/
[codetriage]: http://www.codetriage.com/gitlabhq/gitlabhq
[accepting-mrs-weight]: https://gitlab.com/gitlab-org/gitlab-pages/issues?assignee_id=0&label_name[]=Accepting%20Merge%20Requests&sort=weight_asc
[seeking-contributions-weight]: https://gitlab.com/gitlab-org/gitlab-pages/-/issues/?sort=weight&state=opened&label_name%5B%5D=Seeking%20community%20contributions&assignee_id=None
[pages-tracker]: https://gitlab.com/gitlab-org/gitlab-pages/issues
[google-group]: https://groups.google.com/forum/#!forum/gitlabhq
[stackoverflow]: https://stackoverflow.com/questions/tagged/gitlab
[fpl]: https://gitlab.com/gitlab-org/gitlab-ce/issues?label_name=feature+proposal
[accepting-mrs]: https://gitlab.com/gitlab-org/gitlab-pages/issues?label_name=Accepting+Merge+Requests
[seeking-community-contributions]: https://gitlab.com/gitlab-org/gitlab-pages/-/issues/?label_name%5B%5D=Seeking%20community%20contributions
[pages-mr-tracker]: https://gitlab.com/gitlab-org/gitlab-pages/merge_requests
[gdk]: https://gitlab.com/gitlab-org/gitlab-development-kit
[git-squash]: https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits
......
......@@ -10,7 +10,7 @@ go 1.18
require (
github.com/golang-jwt/jwt/v4 v4.5.0
github.com/golang/mock v1.6.0
github.com/gorilla/handlers v1.4.2
github.com/gorilla/handlers v1.5.1
github.com/gorilla/mux v1.8.0
github.com/gorilla/securecookie v1.1.1
github.com/gorilla/sessions v1.2.0
......@@ -21,7 +21,7 @@ require (
github.com/pires/go-proxyproto v0.6.2
github.com/prometheus/client_golang v1.12.1
github.com/rs/cors v1.7.0
github.com/sirupsen/logrus v1.8.1
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.7.0
github.com/tj/go-redirects v0.0.0-20200911105812-fd1ba1020b37
gitlab.com/feistel/go-contentencoding v1.0.0
......@@ -30,7 +30,7 @@ require (
golang.org/x/crypto v0.9.0
golang.org/x/net v0.10.0
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/sys v0.8.0
golang.org/x/sys v0.10.0
golang.org/x/time v0.0.0-20201208040808-7e3f01d25324
)
......@@ -41,6 +41,7 @@ require (
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/client9/reopen v1.0.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/felixge/httpsnoop v1.0.1 // indirect
github.com/getsentry/sentry-go v0.13.0 // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/golang/protobuf v1.5.2 // indirect
......
......@@ -85,6 +85,8 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m
github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/felixge/httpsnoop v1.0.1 h1:lvB5Jl89CsZtGIWuTcDM1E/vkVs49/Ml7JJe07l8SPQ=
github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/getsentry/sentry-go v0.13.0 h1:20dgTiUSfxRB/EhMPtxcL9ZEbM1ZdR+W/7f7NWD+xWo=
github.com/getsentry/sentry-go v0.13.0/go.mod h1:EOsfu5ZdvKPfeHYV6pTVQnsjfp30+XA7//UooKNumH0=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
......@@ -178,8 +180,8 @@ github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5 h1:sjZBwGj9Jlw33ImPtvFviGYvseOtDM7hkSKB7+Tv3SM=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
github.com/gorilla/handlers v1.4.2 h1:0QniY0USkHQ1RGCLfKxeNHK9bkDHGRYGNDFBCS+YARg=
github.com/gorilla/handlers v1.4.2/go.mod h1:Qkdc/uu4tH4g6mTK6auzZ766c4CA0Ng8+o/OAirnOIQ=
github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4=
github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q=
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ=
......@@ -274,8 +276,8 @@ github.com/sebest/xff v0.0.0-20210106013422-671bd2870b3a/go.mod h1:wozgYq9WEBQBa
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
......@@ -435,7 +437,6 @@ golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
......@@ -475,8 +476,9 @@ golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA=
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
......
......@@ -133,7 +133,15 @@ func (a *Artifact) makeRequest(w http.ResponseWriter, r *http.Request, reqURL *u
}
w.Header().Set("Content-Type", resp.Header.Get("Content-Type"))
w.Header().Set("Content-Length", strconv.FormatInt(resp.ContentLength, 10))
// If the API uses chunked encoding, it will omit the Content-Length Header.
// Go uses a value of -1, which is an invalid value.
// We should omit the header entirely in that case.
// see: https://gitlab.com/gitlab-org/gitlab-pages/-/issues/1078
if resp.ContentLength >= 0 {
w.Header().Set("Content-Length", strconv.FormatInt(resp.ContentLength, 10))
}
w.WriteHeader(resp.StatusCode)
io.Copy(w, resp.Body)
}
......
......@@ -17,22 +17,24 @@ func TestTryMakeRequest(t *testing.T) {
contentType := "text/html; charset=utf-8"
cases := []struct {
Path string
Token string
Status int
Content string
Length string
CacheControl string
ContentType string
Description string
RemoteAddr string
ForwardedIP string
Path string
Token string
Status int
Content string
APIUsesChunkedEncoding bool
Length string
CacheControl string
ContentType string
Description string
RemoteAddr string
ForwardedIP string
}{
{
"/200.html",
"",
http.StatusOK,
content,
false,
"90",
"max-age=3600",
"text/html; charset=utf-8",
......@@ -45,6 +47,7 @@ func TestTryMakeRequest(t *testing.T) {
"token",
http.StatusOK,
content,
false,
"90",
"",
"text/html; charset=utf-8",
......@@ -57,6 +60,7 @@ func TestTryMakeRequest(t *testing.T) {
"",
http.StatusIMUsed,
content,
false,
"90",
"max-age=3600",
"text/html; charset=utf-8",
......@@ -69,6 +73,7 @@ func TestTryMakeRequest(t *testing.T) {
"",
http.StatusTeapot,
content,
false,
"90",
"",
"text/html; charset=utf-8",
......@@ -76,11 +81,24 @@ func TestTryMakeRequest(t *testing.T) {
"1.2.3.4",
"1.2.3.4",
},
{
"/200.html",
"",
http.StatusOK,
content,
true,
"",
"max-age=3600",
"text/html; charset=utf-8",
"basic successful request",
"1.2.3.4:8000",
"1.2.3.4",
},
}
for _, c := range cases {
t.Run(c.Description, func(t *testing.T) {
testServer := makeArtifactServerStub(t, content, contentType, c.ForwardedIP)
testServer := makeArtifactServerStub(t, content, contentType, c.ForwardedIP, c.APIUsesChunkedEncoding)
defer testServer.Close()
url := "https://group.gitlab-example.io/-/subgroup/project/-/jobs/1/artifacts" + c.Path
......@@ -104,7 +122,8 @@ func TestTryMakeRequest(t *testing.T) {
}
// provide stub for testing different artifact responses
func makeArtifactServerStub(t *testing.T, content string, contentType string, expectedForwardedIP string) *httptest.Server {
func makeArtifactServerStub(t *testing.T, content string, contentType string,
expectedForwardedIP string, chunkedEncoding bool) *httptest.Server {
return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
require.Equal(t, expectedForwardedIP, r.Header.Get("X-Forwarded-For"))
......@@ -125,6 +144,11 @@ func makeArtifactServerStub(t *testing.T, content string, contentType string, ex
w.WriteHeader(999)
}
fmt.Fprint(w, content)
if chunkedEncoding {
// this forces go to use chunked encoding
// and omitting the "Content-Length" Header
w.(http.Flusher).Flush()
}
}))
}
......@@ -296,7 +320,7 @@ func TestBuildURL(t *testing.T) {
func TestContextCanceled(t *testing.T) {
content := "<!DOCTYPE html><html><head><title>Title of the document</title></head><body></body></html>"
contentType := "text/html; charset=utf-8"
testServer := makeArtifactServerStub(t, content, contentType, "")
testServer := makeArtifactServerStub(t, content, contentType, "", false)
t.Cleanup(testServer.Close)
result := httptest.NewRecorder()
......
......@@ -22,7 +22,8 @@ var HandleReadErrors = Feature{
// ConfigurableRoot enables a project's root directory to be customized using
// the GitLab API
var ConfigurableRoot = Feature{
EnvVariable: "FF_CONFIGURABLE_ROOT_DIR",
EnvVariable: "FF_CONFIGURABLE_ROOT_DIR",
defaultEnabled: true,
}
// Enabled reads the environment variable responsible for the feature flag
......