Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content negotiation handling #1112

Open
nekr0z opened this issue Jul 9, 2023 · 3 comments
Open

Content negotiation handling #1112

nekr0z opened this issue Jul 9, 2023 · 3 comments
Labels
C: Bug Something isn't working

Comments

@nekr0z
Copy link

nekr0z commented Jul 9, 2023

Fetching a Plume page at https://blog.nataraj.ru/~/It/%D0%92%D1%8B%D0%BF%D1%83%D1%81%D1%82%D0%B8%D0%BB%20%D1%80%D0%B5%D0%BB%D0%B8%D0%B7%20%D0%B8%D0%B3%D1%80%D1%8B%20Goblin%20Camp%20v0.23 with just Accept: application/activity+json returns AS2 (as expected). Fetching the same URL with Accept: application/activity+json; q=0.9, application/ld+json;profile="https://www.w3.org/ns/activitystreams"; q=0.8, text/html; charset=utf-8; q=0.7 (as Bridgy Fed does, for example) returns HTML with no rel=alternate link pointing to AS2, thus making Fediverse interaction fail.

  • Plume version: 0.7.2
  • Operating system: Any
  • Web Browser: Any
@nekr0z nekr0z added the C: Bug Something isn't working label Jul 9, 2023
@trinity-1686a
Copy link
Contributor

Plume should match on the application/activity+json; q=0.9 part but fails to because it doesn't understand the q=0.9 part (which it should), however the profile for the 2nd content type seems wrong, it lacks a final ". With it present, Plume seems to answer with a json document

@nekr0z
Copy link
Author

nekr0z commented Jul 10, 2023

Plume should match on the application/activity+json; q=0.9 part but fails to because it doesn't understand the q=0.9 part (which it should), however the profile for the 2nd content type seems wrong, it lacks a final ". With it present, Plume seems to answer with a json document

My bad, I only provided a part of the header that provokes the HTML response; here it is in full:
Accept: application/activity+json; q=0.9, application/ld+json;profile="https://www.w3.org/ns/activitystreams"; q=0.8, text/html; charset=utf-8; q=0.7

I've updated the top post, too.

@sknebel
Copy link

sknebel commented Jul 10, 2023

rocket has some support for handling media types that on first glance looks like it would remove the need for custom parsing code for the more complex cases, and handlesq= values and parameters on media types: https://api.rocket.rs/v0.4/rocket/http/struct.Accept.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants