mirror of
https://git.mirrors.martin98.com/https://github.com/jina-ai/reader.git
synced 2025-08-20 12:39:15 +08:00
fix: curl redirections
This commit is contained in:
parent
8ec8123ff4
commit
a7a41250d4
@ -219,7 +219,7 @@ export class CurlControl extends AsyncService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([301, 302, 307, 308].includes(statusCode)) {
|
if ([301, 302, 303, 307, 308].includes(statusCode)) {
|
||||||
if (stream) {
|
if (stream) {
|
||||||
stream.resume();
|
stream.resume();
|
||||||
}
|
}
|
||||||
@ -305,7 +305,7 @@ export class CurlControl extends AsyncService {
|
|||||||
do {
|
do {
|
||||||
const r = await this.urlToFile1Shot(nextHopUrl, opts);
|
const r = await this.urlToFile1Shot(nextHopUrl, opts);
|
||||||
|
|
||||||
if ([301, 302, 307, 308].includes(r.statusCode)) {
|
if ([301, 302, 303, 307, 308].includes(r.statusCode)) {
|
||||||
fakeHeaderInfos.push(...r.headers);
|
fakeHeaderInfos.push(...r.headers);
|
||||||
const headers = r.headers[r.headers.length - 1];
|
const headers = r.headers[r.headers.length - 1];
|
||||||
const location: string | undefined = headers.Location || headers.location;
|
const location: string | undefined = headers.Location || headers.location;
|
||||||
@ -406,8 +406,15 @@ export class CurlControl extends AsyncService {
|
|||||||
return new AssertionFailureError(msg);
|
return new AssertionFailureError(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Maybe retry but dont retry with curl again
|
||||||
|
case CurlCode.CURLE_UNSUPPORTED_PROTOCOL:
|
||||||
|
case CurlCode.CURLE_PEER_FAILED_VERIFICATION: {
|
||||||
|
return new ServiceBadApproachError(msg);
|
||||||
|
}
|
||||||
|
|
||||||
// Retryable errors
|
// Retryable errors
|
||||||
case CurlCode.CURLE_REMOTE_ACCESS_DENIED:
|
case CurlCode.CURLE_REMOTE_ACCESS_DENIED:
|
||||||
|
case CurlCode.CURLE_SEND_ERROR:
|
||||||
case CurlCode.CURLE_RECV_ERROR:
|
case CurlCode.CURLE_RECV_ERROR:
|
||||||
case CurlCode.CURLE_GOT_NOTHING:
|
case CurlCode.CURLE_GOT_NOTHING:
|
||||||
case CurlCode.CURLE_OPERATION_TIMEDOUT:
|
case CurlCode.CURLE_OPERATION_TIMEDOUT:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user