Bug#1065247: new lighttpd serves mangled file names

2024-03-02 Thread Erik de Castro Lopo
Glenn Strauss wrote:

> This will be fixed in the next version of lighttpd, and I'll probably
> submit a patch to Debian sooner.

That would be awesome!!!

Thanks,
Erik
-- 
--
Erik de Castro Lopo
http://www.mega-nerd.com/



Bug#1065247: new lighttpd serves mangled file names

2024-03-02 Thread Glenn Strauss
> I have noticed something odd though. I created a directory which when
> served by lighttpd in Firefox looks like:
> 
> Index of /test/
> ../   -   Directory
> This is just a test.mkv/  2024-Mar-03 13:22:24583.7M  video/x-matroska
> This is just a test.txt/  2024-Mar-03 13:05:210.1K
> text/plain;charset=utf-8

There is a regression in lighttpd 1.4.74 and will be fixed in lighttpd
1.4.75 released later this month (Mar).  The regression causes the
display of filenames in mod_dirlisting to end in '/'.

https://redmine.lighttpd.net/issues/3242

> In Firefox, if I click on the text file it works just as expected and FF shows
> the contents of the text file.
> 
> For the video file however it starts a download, but renames the file to
> `6GQOZxf0.mpv` (an MS-DOS like 8.3 filename).
> 
> If I use wget to retrieve the file I get this:
> 
> > wget -S http://white:8080/test/This%20is%20just%20a%20test.mkv/
> --2024-03-03 13:38:41--  
> http://white:8080/test/This%20is%20just%20a%20test.mkv/
> Resolving white (white)... 192.168.1.8
> Connecting to white (white)|192.168.1.8|:8080... connected.
> HTTP request sent, awaiting response... 
>   HTTP/1.1 200 OK
>   Content-Type: video/x-matroska
>   ETag: "72386044"
>   Last-Modified: Sun, 03 Mar 2024 02:22:24 GMT
>   Content-Length: 612101519
>   Accept-Ranges: bytes
>   Date: Sun, 03 Mar 2024 02:38:41 GMT
>   Server: lighttpd/1.4.74
> Length: 612101519 (584M) [video/x-matroska]
> Saving to: ‘index.html.1’
> 
> However, if I drop the trailing `/` from the filename it works as expected:
> 
> 
> > wget -S http://white:8080/test/This%20is%20just%20a%20test.mkv
> --2024-03-03 13:40:38--  
> http://white:8080/test/This%20is%20just%20a%20test.mkv
> Resolving white (white)... 192.168.1.8
> Connecting to white (white)|192.168.1.8|:8080... connected.
> HTTP request sent, awaiting response... 
>   HTTP/1.1 200 OK
>   Content-Type: video/x-matroska
>   ETag: "72386044"
>   Last-Modified: Sun, 03 Mar 2024 02:22:24 GMT
>   Content-Length: 612101519
>   Accept-Ranges: bytes
>   Date: Sun, 03 Mar 2024 02:40:38 GMT
>   Server: lighttpd/1.4.74
> Length: 612101519 (584M) [video/x-matroska]
> Saving to: ‘This is just a test.mkv’
> 
> My guess is that that problem is in the module that generates the listing
> for a directory and that the problem is that it puts a trailing `/` on 
> file as well as just directories.
> 
> I use lighttpd to serve viedo files for a kodi.tv box, so I cannot maually
> correct the generated directory listings that lighttpd gives me.

Ok, so it sounds to me like the client is renaming the downloaded file,
not lighttpd, due to the bug in lighttpd 1.4.74 mod_dirlisting
erroneously adding a trailing '/' to the filename.

This will be fixed in the next version of lighttpd, and I'll probably
submit a patch to Debian sooner.

Cheers, Glenn



Bug#1065247: new lighttpd serves mangled file names

2024-03-02 Thread Erik de Castro Lopo
Hi,

I have included the config at the bottom of this email.

The files are being served from an ext4 filesystem.

I have noticed something odd though. I created a directory which when
served by lighttpd in Firefox looks like:

Index of /test/
../ -   Directory
This is just a test.mkv/2024-Mar-03 13:22:24583.7M  video/x-matroska
This is just a test.txt/2024-Mar-03 13:05:210.1K
text/plain;charset=utf-8

Notice how both files have a '/' at the end of their name.

In Firefox, if I click on the text file it works just as expected and FF shows
the contents of the text file.

For the video file however it starts a download, but renames the file to
`6GQOZxf0.mpv` (an MS-DOS like 8.3 filename).

If I use wget to retrieve the file I get this:

> wget -S http://white:8080/test/This%20is%20just%20a%20test.mkv/
--2024-03-03 13:38:41--  
http://white:8080/test/This%20is%20just%20a%20test.mkv/
Resolving white (white)... 192.168.1.8
Connecting to white (white)|192.168.1.8|:8080... connected.
HTTP request sent, awaiting response... 
  HTTP/1.1 200 OK
  Content-Type: video/x-matroska
  ETag: "72386044"
  Last-Modified: Sun, 03 Mar 2024 02:22:24 GMT
  Content-Length: 612101519
  Accept-Ranges: bytes
  Date: Sun, 03 Mar 2024 02:38:41 GMT
  Server: lighttpd/1.4.74
Length: 612101519 (584M) [video/x-matroska]
Saving to: ‘index.html.1’

However, if I drop the trailing `/` from the filename it works as expected:


> wget -S http://white:8080/test/This%20is%20just%20a%20test.mkv
--2024-03-03 13:40:38--  
http://white:8080/test/This%20is%20just%20a%20test.mkv
Resolving white (white)... 192.168.1.8
Connecting to white (white)|192.168.1.8|:8080... connected.
HTTP request sent, awaiting response... 
  HTTP/1.1 200 OK
  Content-Type: video/x-matroska
  ETag: "72386044"
  Last-Modified: Sun, 03 Mar 2024 02:22:24 GMT
  Content-Length: 612101519
  Accept-Ranges: bytes
  Date: Sun, 03 Mar 2024 02:40:38 GMT
  Server: lighttpd/1.4.74
Length: 612101519 (584M) [video/x-matroska]
Saving to: ‘This is just a test.mkv’

My guess is that that problem is in the module that generates the listing
for a directory and that the problem is that it puts a trailing `/` on 
file as well as just directories.

I use lighttpd to serve viedo files for a kodi.tv box, so I cannot maually
correct the generated directory listings that lighttpd gives me.

Thanks,
Erik



> sudo lighttpd -f /etc/lighttpd/lighttpd.conf -p
config {
var.CWD= "/home/erikd"
var.PID= 1524394
server.modules = ("mod_indexfile", "mod_access", 
"mod_alias", "mod_compress", "mod_redirect")
server.document-root   = "/var/www/html"
server.upload-dirs = ("/var/cache/lighttpd/uploads")
server.errorlog= "/var/log/lighttpd/error.log"
server.pid-file= "/var/run/lighttpd.pid"
server.username= "www-data"
server.groupname   = "www-data"
server.port= 8080
server.follow-symlink  = "enable"
dir-listing.activate   = "enable"
index-file.names   = ("index.php", "index.html")
url.access-deny= ("~", ".inc")
static-file.exclude-extensions = (".php", ".pl", ".fcgi")
compress.cache-dir = "/var/cache/lighttpd/compress/"
compress.filetype  = ("application/javascript", "text/css", 
"text/html", "text/plain")
mimetype.assign= (
".cwl.json"   => "application/cwl+json",
".sarif.json" => "application/sarif+json",
".sarif-external-properties.json" => 
"application/sarif-external-properties+json",
".spdx.json"  => "application/spdx+json",
".tm.json"=> "application/tm+json",
".tm.jsonld"  => "application/tm+json",
".gpkg.tar"   => "application/vnd.gentoo.gpkg",
".1905.1" => "application/vnd.ieee.1905",
".syft.json"  => "application/vnd.syft+json",
".pcf.Z"  => "application/x-font-pcf",
".tar.bz2"=> "application/x-gtar-compressed",
".tar.gz" => "application/x-gtar-compressed",
".a2l"=> "application/A2L",
".aml"=> "application/AML",
".atf"=> "application/ATF",
".atfx"   => "application/ATFX",
".atxml"  => "application/ATXML",
".cdfx"   => "application/CDFX+XML",
".cea"=> 

Bug#1065247: new lighttpd serves mangled file names

2024-03-02 Thread Erik de Castro Lopo
Erik de Castro Lopo wrote:

> Hi,
> 
> I have included the config at the bottom of this email.
> 
> The files are being served from an ext4 filesystem.
> 
> I have noticed something odd though. I created a directory which when
> served by lighttpd in Firefox looks like:

I found the documentation for the directory listing functionality:

https://redmine.lighttpd.net/projects/lighttpd/wiki/Mod_dirlisting

But that does not seem to offer any clues.

Erik
-- 
--
Erik de Castro Lopo
http://www.mega-nerd.com/