DIRACGrid / diracx

The neXt DIRAC generation
GNU General Public License v3.0
8 stars 19 forks source link

Make the client send its version when calling the server #258

Open chaen opened 2 months ago

chaen commented 2 months ago

The server should given an error if the client version is too old

The minimum version should be configured in the pyproject as a metadata such that the extension can overwrite it (diracx.min_client_version)

chrisburr commented 2 months ago
X-DIRACX-CLIENT-VERSION: 1.2.4
[project.entry-points."diracx.min_client_version"]
diracx = "1.2.3"
lhcbdirac = "5.6.7"
chaen commented 1 month ago

Side note: I don't think we will have millions of them, but do we want the diracx headers to be easily distinguishable from others ? That is, do we want e.g. DiracX-Client-Version more than client-version ? It's nice when it's easy to spot so I would be tempted to add an extra prefix. The X- standard is deprecated though (https://www.rfc-editor.org/rfc/rfc6648#page-4)

Also, this raises the question: what do we do in case there isn't a version ? (swagger, diracx-web)

natthan-pigoux commented 1 month ago

Yes, I already changed the name with X-Diracx-Client-Version. I will remove the X- then. I also added a TODO with the question on what to do in that cas. Thanks again for your help @chaen :)

aldbr commented 1 month ago

what do we do in case there isn't a version ? (swagger, diracx-web)

I guess the server should check the DiracX-Client-Version only if it is provided by the client, shouldn't it?

natthan-pigoux commented 1 month ago

Another point is that the entrypoints in the toml for the "min_client_version" cannot be a static string but: [project.entry-points."diracx.min_client_version"] diracx = "diracx.routers:DIRACX_MIN_CLIENT_VERSION"

I hard coded it there for now: https://github.com/DIRACGrid/diracx/pull/267/commits/d0ff92f1cabae2c1ceb9e1101be2fee5109faba6#diff-424d2a991980de5065c3b1e58f5066bf78641a4804b34bb5977be2ad95289ae7R483