This commit is contained in:
dev-claw
2025-09-06 14:19:34 +01:00
committed by GitHub
parent ca77074ef6
commit 9283ab7837
8 changed files with 28 additions and 14 deletions
@@ -44,8 +44,9 @@ internal class AcidimgHost(
)
)
)
it.setAbsoluteRequestUri(true)
}.also { context.requests.add(it) }
log.debug(String.format("Requesting %s", httpPost.uri))
log.info("Requesting {}", httpPost)
val doc = try {
httpService.client.execute(
httpPost, context.httpContext
@@ -157,8 +157,11 @@ internal abstract class Host(
@Throws(HostException::class)
fun head(url: String, context: ImageDownloadContext): Array<Header> {
val httpHead = HttpHead(url).also { context.requests.add(it) }
log.debug(String.format("Requesting %s", url))
val httpHead = HttpHead(url).also {
it.setAbsoluteRequestUri(true)
context.requests.add(it)
}
log.info("Requesting {}", httpHead)
return httpService.client.execute(
httpHead,
context.httpContext
@@ -177,8 +180,11 @@ internal abstract class Host(
transformer: (ClassicHttpResponse) -> T
): T {
val httpGet =
HttpGet(url).also { it.addHeader("Referer", context.imageEntity.url) }.also { context.requests.add(it) }
log.debug(String.format("Requesting %s", url))
HttpGet(url).also {
it.addHeader("Referer", context.imageEntity.url)
it.setAbsoluteRequestUri(true)
}.also { context.requests.add(it) }
log.info("Requesting {}", httpGet)
return httpService.client.execute(httpGet, context.httpContext) {
if (it.code / 100 != 2) {
throw DownloadException("Server returned code ${it.code}")
@@ -51,7 +51,12 @@ internal class ImxHost : Host("imx.to", 8) {
val imgUrl = findPattern(image, subDomain)
val result = runCatching {
RequestLimit.getPermit(1)
val httpHead = HttpHead(imgUrl).also { context.requests.add(it) }
val httpHead = HttpHead(imgUrl)
.also {
it.setAbsoluteRequestUri(true)
context.requests.add(it)
}
log.info("Requesting: {}", httpHead)
failFastHttpClient.execute(httpHead) { response ->
if (response.code / 100 != 2) {
throw HostException("Invalid response code ${response.code}")
@@ -58,8 +58,9 @@ internal class VGAuthService(
BasicNameValuePair("vb_login_md5password", password)
)
)
it.setAbsoluteRequestUri(true)
}
log.info("Authenticating: ${postAuth.uri}")
log.info("Authenticating: {}", postAuth)
try {
val context = HttpClientContext.create().apply {
cookieStore =
@@ -41,10 +41,10 @@ internal class FetchMetadataTask(
it.setParameter(
"p", postId.toString()
)
}.build())
}.build()).also { it.setAbsoluteRequestUri(true) }
RequestLimit.getPermit(1)
log.debug("Requesting {}", httpGet.uri)
log.info("Requesting {}", httpGet)
val response = httpService.client.execute(httpGet, vgAuthService.createVgContext()) {
if (it.code / 100 != 2) {
throw DownloadException("Unexpected response code '${it.code}' for $httpGet")
@@ -40,9 +40,10 @@ internal class LeaveThanksTask(
BasicNameValuePair("securitytoken", postEntity.token)
)
)
it.setAbsoluteRequestUri(true)
}
RequestLimit.getPermit(1)
log.info("Posting {}", postThanks.uri)
log.info("Posting {}", postThanks)
cm.client.execute(postThanks, context) { response ->
if (response.code / 100 != 2) {
throw VripperException("Unexpected response code '${response.code}' for $postThanks")
@@ -32,7 +32,7 @@ internal class PostLookupAPIParser(private val threadId: Long, private val postI
it.setParameter(
"p", postId.toString()
)
}.build())
}.build()).also { it.setAbsoluteRequestUri(true) }
val threadLookupAPIResponseHandler = ThreadLookupAPIResponseHandler()
Tasks.increment()
return try {
@@ -42,7 +42,7 @@ internal class PostLookupAPIParser(private val threadId: Long, private val postI
)
}.get(CheckedSupplier {
RequestLimit.getPermit(1)
log.info("Requesting {}", httpGet.uri)
log.info("Requesting {}", httpGet)
httpService.client.execute(
httpGet,
vgAuthService.createClickContext()
@@ -33,7 +33,7 @@ internal class ThreadLookupAPIParser(private val threadId: Long) : KoinComponent
"t",
threadId.toString()
)
}.build())
}.build()).also { it.setAbsoluteRequestUri(true) }
val threadLookupAPIResponseHandler = ThreadLookupAPIResponseHandler()
Tasks.increment()
return try {
@@ -44,7 +44,7 @@ internal class ThreadLookupAPIParser(private val threadId: Long) : KoinComponent
)
}.get(CheckedSupplier {
RequestLimit.getPermit(1)
log.info("Requesting {}", httpGet.uri)
log.info("Requesting {}", httpGet)
cm.client.execute(
httpGet, vgAuthService.createClickContext()
) { response ->