youssef hachicha
11/27/2024, 3:51 PMjava.io.IOException: expected 0 bytes but received 20
- Retrofit code works without issues
- I've tried multiple configuration approaches, including:
- Disabling plugins
- Creating fresh HttpClient
- Configuring engine settings
- I even used OkHttp directly and it worked: val client = OkHttpClient.Builder().followRedirects(true).build()
- I am not trying to use neither OkHttp or Retrofit because the project is Multiplatform
Code snippet demonstrating the issue:
suspend fun getHeaderValue(header: String): String? {
return client.head(url) {
// Add headers
}.headers[header]
}
Has anyone encountered similar issues with Ktor HEAD requests? Any insights into why this might be happening or how to resolve it?Chrimaeon
11/27/2024, 4:47 PMyoussef hachicha
11/27/2024, 7:15 PMval result = client.head(url)
println(".....")
the println won't be reached
as of the Retrofit Impl
this is what returns as headers
headers: content-type: application/json
accept-ranges: bytes
cache-control: max-age=60
content-disposition: attachment; filename="019.mp3"; filename*=UTF-8''019.mp3
content-security-policy: sandbox
pragma: public
referrer-policy: no-referrer
vary: Origin, Accept-Encoding
x-content-security-policy: sandbox
x-content-type-options: nosniff
x-robots-tag: noindex, nofollow, noimageindex
x-server-response-time: 344
x-webkit-csp: sandbox
date: Wed, 27 Nov 2024 13:12:49 GMT
server: envoy
strict-transport-security: max-age=31536000; includeSubDomains; preload
content-encoding: gzip
x-dropbox-response-origin: far_remote
x-dropbox-request-id: ca79bc683b3049588f8d4be94d37e7e4
Chrimaeon
11/27/2024, 7:21 PMcurl --head -v <url>
to maybe get some more output.youssef hachicha
11/27/2024, 7:22 PMChrimaeon
11/27/2024, 7:23 PMyoussef hachicha
11/28/2024, 7:05 AMHEAD /scl/fi/ydgdlw9sa01beir9x4jz/113.mp3?rlkey=s92qiy4ew7y7260xqkg8y2wsb&dl=1 HTTP/2
Host: www.dropbox.com
User-Agent: curl/8.4.0
Accept: /< HTTP/2 302 HTTP/2 302 < content-security-policy: frame-ancestors 'self' https://*.dropbox.com ; report-uri https://www.dropbox.com/csp_log?policy_name=metaserver-whitelist ; worker-src https://www.dropbox.com/static/serviceworker/ https://www.dropbox.com/encrypted_folder_download/service_worker.js https://www.dropbox.com/service_worker.js blob: ; base-uri 'self' ; form-action https://docs.google.com/document/fsip/ https://docs.google.com/spreadsheets/fsip/ https://docs.google.com/presentation/fsip/ https://docs.sandbox.google.com/document/fsip/ https://docs.sandbox.google.com/spreadsheets/fsip/ https://docs.sandbox.google.com/presentation/fsip/ https://*.purple.officeapps.live-int.com https://officeapps-df.live.com https://*.officeapps-df.live.com https://officeapps.live.com https://*.officeapps.live.com https://paper.dropbox.com/cloud-docs/edit 'self' https://www.dropbox.com/ https://dl-web.dropbox.com/ https://photos.dropbox.com/ https://paper.dropbox.com/ https://showcase.dropbox.com/ https://www.hellofax.com/ https://app.hellofax.com/ https://www.hellosign.com/ https://app.hellosign.com/ https://docsend.com/ https://www.docsend.com/ https://help.dropbox.com/ https://navi.dropbox.jp/ https://a.sprig.com/ https://selfguidedlearning.dropboxbusiness.com/ https://instructorledlearning.dropboxbusiness.com/ https://sales.dropboxbusiness.com/ https://accounts.google.com/ https://api.login.yahoo.com/ https://login.yahoo.com/ https://experience.dropbox.com/ https://pal-test.adyen.com https://2e83413d8036243b-Dropbox-pal-live.adyenpayments.com/ https://onedrive.live.com/picker ; object-src 'self' https://cfl.dropboxstatic.com/static/ https://www.dropboxstatic.com/static/ ; connect-src https://* ws://127.0.0.1:*/ws blob: wss://dsimports.dropbox.com/ ; default-src https://www.dropbox.com/playlist/ https://www.dropbox.com/v/s/playlist/ https://*.dropboxusercontent.com/p/hls_master_playlist/ https://*.dropboxusercontent.com/p/hls_playlist/ ; script-src 'unsafe-eval' 'inline-speculation-rules' https://www.dropbox.com/static/api/ https://www.dropbox.com/pithos/* https://www.dropbox.com/page_success/ https://cfl.dropboxstatic.com/static/ https://www.dropboxstatic.com/static/ https://accounts.google.com/gsi/client https://canny.io/sdk.js https://www.paypal.com/sdk/js https://www.google.com/recaptcha/ https://www.gstatic.com/recaptcha/ 'unsafe-inline' ; font-src https://* data: ; img-src https://* data: blob: ; media-src https://* blob: ; style-src https://* 'unsafe-inline' 'unsafe-eval' ; frame-src https://* carousel: dbapi-6: dbapi-7: dbapi-8: dropbox-client: itms-apps: itms-appss: ; child-src https://www.dropbox.com/static/serviceworker/ blob: content-security-policy: frame-ancestors 'self' https://*.dropbox.com ; report-uri https://www.dropbox.com/csp_log?policy_name=metaserver-whitelist ; worker-src https://www.dropbox.com/static/serviceworker/ https://www.dropbox.com/encrypted_folder_download/service_worker.js https://www.dropbox.com/service_worker.js blob: ; base-uri 'self' ; form-action https://docs.google.com/document/fsip/ https://docs.google.com/spreadsheets/fsip/ https://docs.google.com/presentation/fsip/ https://docs.sandbox.google.com/document/fsip/ https://docs.sandbox.google.com/spreadsheets/fsip/ https://docs.sandbox.google.com/presentation/fsip/ https://*.purple.officeapps.live-int.com https://officeapps-df.live.com https://*.officeapps-df.live.com https://officeapps.live.com https://*.officeapps.live.com https://paper.dropbox.com/cloud-docs/edit 'self' https://www.dropbox.com/ https://dl-web.dropbox.com/ https://photos.dropbox.com/ https://paper.dropbox.com/ https://showcase.dropbox.com/ https://www.hellofax.com/ https://app.hellofax.com/ https://www.hellosign.com/ https://app.hellosign.com/ https://docsend.com/ https://www.docsend.com/ https://help.dropbox.com/ https://navi.dropbox.jp/ https://a.sprig.com/ https://selfguidedlearning.dropboxbusiness.com/ https://instructorledlearning.dropboxbusiness.com/ https://sales.dropboxbusiness.com/ https://accounts.google.com/ https://api.login.yahoo.com/ https://login.yahoo.com/ https://experience.dropbox.com/ https://pal-test.adyen.com https://2e83413d8036243b-Dropbox-pal-live.adyenpayments.com/ https://onedrive.live.com/picker ; object-src 'self' https://cfl.dropboxstatic.com/static/ https://www.dropboxstatic.com/static/ ; connect-src https://* ws://127.0.0.1:*/ws blob: wss://dsimports.dropbox.com/ ; default-src https://www.dropbox.com/playlist/ https://www.dropbox.com/v/s/playlist/ https://*.dropboxusercontent.com/p/hls_master_playlist/ https://*.dropboxusercontent.com/p/hls_playlist/ ; script-src 'unsafe-eval' 'inline-speculation-rules' https://www.dropbox.com/static/api/ https://www.dropbox.com/pithos/* https://www.dropbox.com/page_success/ https://cfl.dropboxstatic.com/static/ https://www.dropboxstatic.com/static/ https://accounts.google.com/gsi/client https://canny.io/sdk.js https://www.paypal.com/sdk/js https://www.google.com/recaptcha/ https://www.gstatic.com/recaptcha/ 'unsafe-inline' ; font-src https://* data: ; img-src https://* data: blob: ; media-src https://* blob: ; style-src https://* 'unsafe-inline' 'unsafe-eval' ; frame-src https://* carousel: dbapi-6: dbapi-7: dbapi-8: dropbox-client: itms-apps: itms-appss: ; child-src https://www.dropbox.com/static/serviceworker/ blob: < content-type: text/html; charset=utf-8 content-type: text/html; charset=utf-8 < location: https://uc3a641717d29544fbdf06084463.dl.dropboxusercontent.com/cd/0/inline/CfMU4AnjYnNjFLkIyBcpvK9TugEc1HTnsbaT6bcRw0QQ2r1aR5kwqkEkUzvyrnucalGJBf4zNcPUpqt0TUxzgEWd-LcZ-3UagoCXeOk74UJLYdJ2a47RDGkR8Vv6VE8YS-tid2Oq6syMMsymRp-gHb6O/file?dl=1# location: https://uc3a641717d29544fbdf06084463.dl.dropboxusercontent.com/cd/0/inline/CfMU4AnjYnNjFLkIyBcpvK9TugEc1HTnsbaT6bcRw0QQ2r1aR5kwqkEkUzvyrnucalGJBf4zNcPUpqt0TUxzgEWd-LcZ-3UagoCXeOk74UJLYdJ2a47RDGkR8Vv6VE8YS-tid2Oq6syMMsymRp-gHb6O/file?dl=1# < pragma: no-cache pragma: no-cache < referrer-policy: strict-origin-when-cross-origin referrer-policy: strict-origin-when-cross-origin < set-cookie: gvc=MTMxNzU1MjEyNTI1NTQzNjQ5ODY4NTIyMDE5Nzg0Mzc5MTU2MzM3; Path=/; Expires=Tue, 27 Nov 2029 070223 GMT; HttpOnly; Secure; SameSite=None set-cookie: gvc=MTMxNzU1MjEyNTI1NTQzNjQ5ODY4NTIyMDE5Nzg0Mzc5MTU2MzM3; Path=/; Expires=Tue, 27 Nov 2029 070223 GMT; HttpOnly; Secure; SameSite=None < set-cookie: t=IuikxkhMkHtLwG4WahUEpyi4; Path=/; Domain=dropbox.com; Expires=Fri, 28 Nov 2025 070223 GMT; HttpOnly; Secure; SameSite=None set-cookie: t=IuikxkhMkHtLwG4WahUEpyi4; Path=/; Domain=dropbox.com; Expires=Fri, 28 Nov 2025 070223 GMT; HttpOnly; Secure; SameSite=None < set-cookie: __Host-js_csrf=IuikxkhMkHtLwG4WahUEpyi4; Path=/; Expires=Fri, 28 Nov 2025 070223 GMT; Secure; SameSite=None set-cookie: __Host-js_csrf=IuikxkhMkHtLwG4WahUEpyi4; Path=/; Expires=Fri, 28 Nov 2025 070223 GMT; Secure; SameSite=None < set-cookie: __Host-ss=pSoJcCP_Y0; Path=/; Expires=Fri, 28 Nov 2025 070223 GMT; HttpOnly; Secure; SameSite=Strict set-cookie: __Host-ss=pSoJcCP_Y0; Path=/; Expires=Fri, 28 Nov 2025 070223 GMT; HttpOnly; Secure; SameSite=Strict < set-cookie: locale=en; Path=/; Domain=dropbox.com; Expires=Tue, 27 Nov 2029 070223 GMT set-cookie: locale=en; Path=/; Domain=dropbox.com; Expires=Tue, 27 Nov 2029 070223 GMT < x-content-type-options: nosniff x-content-type-options: nosniff < x-permitted-cross-domain-policies: none x-permitted-cross-domain-policies: none < x-robots-tag: noindex, nofollow, noimageindex x-robots-tag: noindex, nofollow, noimageindex < x-xss-protection: 1; mode=block x-xss-protection: 1; mode=block < content-length: 17 content-length: 17 < date: Thu, 28 Nov 2024 070223 GMT date: Thu, 28 Nov 2024 070223 GMT < strict-transport-security: max-age=31536000; includeSubDomains strict-transport-security: max-age=31536000; includeSubDomains < server: envoy server: envoy < cache-control: no-cache, no-store cache-control: no-cache, no-store < x-dropbox-response-origin: far_remote x-dropbox-response-origin: far_remote < x-dropbox-request-id: 192c443f48884e1ca7289b9b95c49406 x-dropbox-request-id: 192c443f48884e1ca7289b9b95c49406 < * Connection #0 to host www.dropbox.com left intact
Aleksei Tirman [JB]
11/28/2024, 11:40 AMyoussef hachicha
11/28/2024, 1:12 PMAleksei Tirman [JB]
11/28/2024, 1:59 PMyoussef hachicha
11/28/2024, 2:13 PMAleksei Tirman [JB]
11/28/2024, 2:14 PMAleksei Tirman [JB]
11/28/2024, 2:17 PMyoussef hachicha
11/28/2024, 2:26 PM