Commit b13b30e
committed
Send a User-Agent header on registry requests
Registry requests built by RegistryClient went out without a User-Agent
header. The central request() method constructed an HTTPClientRequest and
only ever set Authorization plus any caller-supplied headers, and
AsyncHTTPClient does not add a default User-Agent of its own, so every
registry operation (manifest resolves, blob fetches, token exchanges, and
pushes) was anonymous on the wire.
HTTP/1.1 only recommends User-Agent rather than requiring it, but in
practice some registries and forward proxies reject, rate-limit, or
otherwise mishandle requests that omit it, and operators rely on it for
attribution and debugging.
The client already carried a clientID ("containerization-registry-client"
by default), but it was only used as the OAuth client_id form field when
fetching tokens, never as an HTTP header. Set the User-Agent from clientID
at the single point where requests are constructed so it applies uniformly
to every registry call including retries and token fetches. A caller that
passes its own User-Agent in the per-request headers still takes
precedence, and no duplicate header is emitted.1 parent 5796abe commit b13b30e
3 files changed
Lines changed: 84 additions & 4 deletions
File tree
- Sources/ContainerizationOCI/Client
- Tests/ContainerizationOCITests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
| 202 | + | |
202 | 203 | | |
203 | 204 | | |
204 | 205 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
144 | 170 | | |
145 | 171 | | |
146 | 172 | | |
| |||
152 | 178 | | |
153 | 179 | | |
154 | 180 | | |
155 | | - | |
156 | | - | |
| 181 | + | |
157 | 182 | | |
158 | 183 | | |
159 | 184 | | |
| |||
167 | 192 | | |
168 | 193 | | |
169 | 194 | | |
170 | | - | |
171 | | - | |
172 | 195 | | |
173 | 196 | | |
174 | 197 | | |
| |||
Lines changed: 56 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
0 commit comments