RDFLib / pyLDAPI

A very small module to add Linked Data API functionality to a Python Flask installation
BSD 3-Clause "New" or "Revised" License
41 stars 11 forks source link

chrome request header "application/signed-exchange;v=b3;q=0.9" causing Registry render error #21

Closed jyucsiro closed 4 years ago

jyucsiro commented 4 years ago

In newer versions of Chrome, the Accept header sent is: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9

Chrome Version: 79.0.3945.88 (Official Build) (64-bit)

This causes an error in pyLDAPI not able to retrieve a format for rendering.

AttributeError: 'RegisterRenderer' object has no attribute 'format'

and r.vf_error set to

'You have requested a Media Type using an Accept header that is incorrectly '
 'formatted.'

This is where it seems to start processing the Accept header: https://github.com/RDFLib/pyLDAPI/blob/db334627e704416f9f1f812697ec51481676eac8/pyldapi/renderer.py#L276

jyucsiro commented 4 years ago

https://wicg.github.io/webpackage/draft-yasskin-http-origin-signed-responses.html#section-8.6 is where Chrome seems to have introduced the v=b3 string

jyucsiro commented 4 years ago

Chrome v78 and earlier doesn't seem to be affected

ashleysommer commented 4 years ago

Closed by https://github.com/RDFLib/pyLDAPI/commit/68a8d2b9d4fdb85c276e6da570a9e0d0eac81125

nicholascar commented 4 years ago

I broke this fix with changes for ConnegP but have now fixed in 3.4: https://github.com/RDFLib/pyLDAPI/commit/8ac446e5f8d667eaa68ad0b03fd2bac37dfdae8c