Closed vlnn closed 1 year ago
The link above that failed; goes to a box-specific link; that link returns data, but with a 501. Interestingly its got Content-type application/json, but firefox is not seeing it as JSON, maybe because of the 501 error.
Reported on Internet Archive internal slack ... not sure if this is something needing fixing in dweb-cors or will get fixed internal to IA.
Thanks a ton!
wget -qO- --server-response "https://ia600501.us.archive.org/BookReader/BookReaderJSIA.php?subPrefix=Compute_Gazette_Issue_12_1984_Jun&server=www-dweb-cors.dev.archive.org&audioLinerNotes=0&id=1984-06-computegazette&itemPath=%2F15%2Fitems%2F1984-06-computegazette&format=json&requestUri=%2Fdetails%2F1984-06-computegazette&itemPath=/15/items/1984-06-computegazette"
Returns
HTTP/1.1 200 OK
Server: nginx/1.18.0 (Ubuntu)
Date: Thu, 01 Dec 2022 23:23:13 GMT
Content-Type: application/x-javascript
Transfer-Encoding: chunked
Connection: keep-alive
Access-Control-Allow-Origin:
Access-Control-Allow-Credentials: true
Strict-Transport-Security: max-age=15724800
Referrer-Policy: no-referrer-when-downgrade
which is wrong because its JSON
However curl -I "https://ia600501.us.archive.org/BookReader/BookReaderJSIA.php?subPrefix=Compute_Gazette_Issue_12_1984_Jun&server=www-dweb-cors.dev.archive.org&audioLinerNotes=0&id=1984-06-computegazette&itemPath=%2F15%2Fitems%2F1984-06-computegazette&format=json&requestUri=%2Fdetails%2F1984-06-computegazette&itemPath=/15/items/1984-06-computegazette"
returns
HTTP/2 501
server: nginx/1.18.0 (Ubuntu)
date: Thu, 01 Dec 2022 21:26:28 GMT
content-type: application/json
strict-transport-security: max-age=15724800
which is wrong because its got a status of 501.
Both appear to return valid JSON
No joy getting the bug dealt with at Internet Archive so I'll see if I can patch a workaround.
dweb-archivecontroller:ArchiveItem#278
is seeing a "res" which is a buffer rather than an object,
Could fix there to turn buffer into JSON but lets go upstream. This comes from...
dweb-transports/httptools#p_GET#198 -> GET -> _GET -> p_httpfetch ->
Which at line 117 checks for it being Content-type text/json and so of course doesn't convert the erroneous result
Best to fix as close to the problem as possible, and since this code uses dweb-cors to get a cleaned up IA API I'll fix it there. ....
dweb-cors#cors.js added an opt to switch the content-type header That fixed this bug, but there is at least one more bug to fix to get this page to work. .... will look at it later.
I can open https://archive.org/details/1984-06-computegazette/ , but not http://box.local:4244/details/1984-06-computegazette/ , as latter emits this log:
and shows page with only Loading 1984-06-computegazette