|
| 1 | +# licenses.nuget.org |
| 2 | + |
| 3 | +## Rationale |
| 4 | + |
| 5 | +With the introduction of the [license expressions](nuspec.md#license) a requirement emerged to have a reliable service |
| 6 | +that would provide a reference text for individual license identifiers, exception identifiers or license expressions. |
| 7 | +An additional requirement for this service is to have a stable URL schema, that is not susceptible to link rot, |
| 8 | +so that we can safely use it to provide backwards compatibility for older clients. |
| 9 | + |
| 10 | +Licenses.nuget.org fulfills that role. Nuget.org uses it to provide the license text reference for packages that |
| 11 | +specify their license using a license expression. `nuget pack` or packing with other |
| 12 | +[client tools](https://docs.microsoft.com/en-us/nuget/install-nuget-client-tools) set |
| 13 | +the [`licenseUrl`](nuspec.md#licenseurl) element to point to licenses.nuget.org to provide backwards |
| 14 | +compatibility with older clients that don't support the `license` element. |
| 15 | + |
| 16 | +## Protocol |
| 17 | + |
| 18 | +Licenses.nuget.org is intended to be viewed by people in their browsers, no machine-readable responses are provided. |
| 19 | +HTTPS protocol must be used and requests are expected to be constructed in a certain way. It only supports `GET` requests. |
| 20 | +It accepts license expressions or license exception identifiers as an input in a way specified below. Please note, that all |
| 21 | +elements of license expressions are case sensitive, and therefore all input to licenses.nuget.org is case sensitive as well. |
| 22 | + |
| 23 | +### License expressions |
| 24 | + |
| 25 | +#### Request |
| 26 | + |
| 27 | +License expressions (including the trivial cases when expression consists of a single license) have to be |
| 28 | +[URL-encoded](https://tools.ietf.org/html/rfc3986#section-2.1) and used as a path in the request to |
| 29 | +licenses.nuget.org. |
| 30 | + |
| 31 | +| License expression | URL to use | |
| 32 | +|:---|:---| |
| 33 | +MIT | https://licenses.nuget.org/MIT |
| 34 | +(MIT) | https://licenses.nuget.org/(MIT) |
| 35 | +(LGPL-2.0-only WITH FLTK-exception OR Apache-2.0+) | https://licenses.nuget.org/(LGPL-2.0-only%20WITH%20FLTK-exception%20OR%20Apache-2.0+) |
| 36 | + |
| 37 | +The service supports only license identifiers and license exception identifiers that are accepted by |
| 38 | +nuget.org. All license expressions that contain unsupported license identifiers |
| 39 | +or license exception identifiers or that does not conform to license expression syntax are considered |
| 40 | +invalid. |
| 41 | + |
| 42 | +#### Response |
| 43 | + |
| 44 | +Licenses.nuget.org responds to requests containing valid license expressions with an HTTP 200 status code and |
| 45 | +a web page containing a description of the license expression: |
| 46 | +* if supplied license expression contains a single license identifier a web page is returned that contains that |
| 47 | +license reference text; |
| 48 | +* if supplied license expression is a composite license expression, a web page is returned that contains |
| 49 | +the license expression with links to individual license or license exception references. |
| 50 | + |
| 51 | +Any requests that contain an invalid license expression result in an HTTP 404 response. |
| 52 | + |
| 53 | +### License exceptions |
| 54 | + |
| 55 | +#### Request |
| 56 | + |
| 57 | +License exception identifiers must be URL-encoded and used as a path in the request to licenses.nuget.org. |
| 58 | +Only a single license exception identifier can be supplied in a single request. No additional characters besides |
| 59 | +license exception identifier may present in the path portion of the URL. |
| 60 | + |
| 61 | +| License exception identifier | URL to use | |
| 62 | +|:---|:---| |
| 63 | +FLTK-exception | https://licenses.nuget.org/FLTK-exception |
| 64 | +openvpn-openssl-exception | https://licenses.nuget.org/openvpn-openssl-exception |
| 65 | + |
| 66 | +#### Response |
| 67 | + |
| 68 | +Licenses.nuget.org responds to a request with a known license exception identifier with a HTTP 200 response and |
| 69 | +a web page containing the reference text for the specified license exception. |
| 70 | + |
| 71 | +Any request containing an unsupported license exception identifier results in an HTTP 404 response. |
0 commit comments