TurboVNC / turbovnc

Main TurboVNC repository
https://TurboVNC.org
GNU General Public License v2.0
761 stars 138 forks source link

Jnpl file size mismatch #287

Closed phraide closed 3 years ago

phraide commented 3 years ago

Hello,

I've found a problem with embedded httpd server for Jnpl files. In HTTP headers, the Content-Length field is fetched from VncViewer.jnlp file size : https://github.com/TurboVNC/turbovnc/blob/1971ca40ffb637bc984355be1ae1d9df594c9367/unix/Xvnc/programs/Xserver/hw/vnc/httpd.c#L316 But, when substitutions happen (from line 344), the Content-Length header doesn't match the final file size anymore. Main problem is that most browsers refuse to download the .jnpl file.

A curl request shows the size mismatch (2453 expected vs 2443 received) :

curl -v -o /dev/null -q XXXXX:5806
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* About to connect() to XXXXX port 5806 (#0)
*   Trying 1.2.3.4...
* Connected to XXXXX(1.2.3.4) port 5806 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: XXXXX:5806
> Accept: */*
>
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Content-Length: 2453
< Last-Modified: Thu, 27 Sep 2018 06:46:21 GMT
< Content-Type: application/x-java-jnlp-file
<
{ [data not shown]
* transfer closed with 10 bytes remaining to read
 99  2453   99  2443    0     0   474k      0 --:--:-- --:--:-- --:--:--  596k
* Closing connection 0
curl: (18) transfer closed with 10 bytes remaining to read

Version used is 2.2 but version 2.2.6 has the same behavior.

Regards

dcommander commented 3 years ago

Should now be fixed in the 2.2.x stable pre-release build. I also added support for HTTP 1.1 HEAD requests, which later versions of Java Web Start seem to use instead of GET requests.