Comment charger une bibliothèque JavaScript dans Rhino, à partir d'un serveur qui utilise le codage GZIP?

StackOverflow https://stackoverflow.com/questions/5942531

Question

Dans Rhino, j'ai l'habitude de pouvoir charger des bibliothèques JavaScript d'une URL, par exemple

load('http://latex.mathoverflow.net/mathjax/MathJax.js')

(Cela ne fonctionne pas réellement, sauf si vous fournissez d'abord un environnement de type navigateur, via env.js ou similaire. Mais Rhino parvient à obtenir le fichier et à commencer à le compiler.)

Cependant, si le serveur fournit la bibliothèque JavaScript gziped, Rhino semble échouer immédiatement avec des erreurs de syntaxe, par exemple

load('http://cdn.mathjax.org/mathjax/latest/MathJax.js')

Vous pouvez voir la différence en utilisant Curl, par exemple

curl --head http://latex.mathoverflow.net/mathjax/MathJax.js

donner

HTTP/1.1 200 OK
Date: Mon, 09 May 2011 21:07:53 GMT
Server: Apache
Last-Modified: Fri, 07 Jan 2011 05:13:36 GMT
ETag: "24b8044-9db7-4993aae2a4000"
Accept-Ranges: bytes
Content-Length: 40375
Vary: Accept-Encoding
Content-Type: application/javascript

tandis que

curl --head http://cdn.mathjax.org/mathjax/latest/MathJax.js

donner

HTTP/1.0 200 OK
Server: nginx
Date: Sun, 08 May 2011 20:06:19 GMT
Content-Type: application/javascript
Last-Modified: Sun, 13 Mar 2011 17:30:00 GMT
ETag: "3f59e66-a250-49e608b6bf600"-gzip
Accept-Ranges: bytes
Content-Encoding: gzip
Cache-Control: max-age=86400
Content-Length: 12466
Age: 3624
X-Cache: Hit from cloudfront
X-Amz-Cf-Id: d0e2d89a0d90c9b7bb49b466e233b005389f96db378543b01de51769589f84dfd9733430f773846f
Via: 1.0 fee706bb2dcbccabb9a09a17e9d6037c.cloudfront.net:11180 (CloudFront), 1.0 6d5d46d2c7dcee5d4601d83b29b92a90.cloudfront.net:11180 (CloudFront)
Connection: close

Aucune suggestion? Y a-t-il une astuce pour permettre à Rhino de charger des scripts gzippés?

Pas de solution correcte

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top