-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
bilibili manga updates broken with undici 6.16.0 #15532
Comments
Searching for maintainers:
If all routes can not be found, the issue will be closed automatically. Please use |
I can reproduce HTTP 400 error with a self-hosted version. After some trials and errors, I noticed that a recent undici update breaks it. If I revert undici to 6.15.0, bilibili manga updates work fine. I noticed there is a new HTTP request header with undici 6.16.0. Per mitmproxy, the
With undici 6.16.0, the request includes one more header:
And the response complains about the {
"code": "invalid_argument",
"meta": {
"argument": "origin"
},
"msg": "origin client"
} FWIW, I tried to override diff --git a/lib/routes/bilibili/manga-update.ts b/lib/routes/bilibili/manga-update.ts
index 2b100dcea..6e0fc1457 100644
--- a/lib/routes/bilibili/manga-update.ts
+++ b/lib/routes/bilibili/manga-update.ts
@@ -36,6 +36,7 @@ async function handler(ctx) {
},
headers: {
Referer: link,
+ Origin: 'https://manga.bilibili.com/',
},
});
const data = response.data.data; but the
And bilibili still returns HTTP 400 about the invalid |
Turns out it's this commit causing this issue which is introduced in nodejs/undici#3193. Minimal repro:import undici from "undici";
const res1 = await undici.request(
"https://manga.bilibili.com/twirp/comic.v2.Comic/ComicDetail?device=pc&platform=web",
{
method: "POST",
headers: {
Accept: "*/*",
'Content-Type': 'application/json',
},
body: JSON.stringify({
comic_id: "32020",
}),
}
);
console.log(await res1.body.json());
const res2 = await undici.fetch(
"https://manga.bilibili.com/twirp/comic.v2.Comic/ComicDetail?device=pc&platform=web",
{
method: "POST",
headers: {
Accept: "*/*",
'Content-Type': 'application/json',
},
body: JSON.stringify({
comic_id: "32020",
}),
}
);
console.log(await res2.json());
// Expected: both res1 and res2 work
// Actual: Only res1 works in 6.16.0 /cc: @gunjam, @KhafraDev and @tsctx |
Thank you for the fix! |
Routes
Full routes
Related documentation
https://docs.rsshub.app/routes/social-media#%E6%BC%AB%E7%94%BB%E6%9B%B4%E6%96%B0
What is expected?
I can get the latest episode for a specific manga
What is actually happening?
The endpoint returns an error (see below)
Deployment information
RSSHub demo (https://rsshub.app)
Deployment information (for self-hosted)
No response
Additional info
FetchError: [POST] "https://manga.bilibili.com/twirp/comic.v2.Comic/ComicDetail?device=pc&platform=web": 400 Bad Request
This is not a duplicated issue
The text was updated successfully, but these errors were encountered: