Open linkerlin opened 2 years ago
Thanks for reporting! I'll reproduce the issue and look into it.
I'm currently unable to reproduce the issue. Here are the steps I tried:
git clone https://github.com/xyproto/algernon
cd algernon
go build -mod=vendor
sudo setcap cap_net_bind_service=+ep ./algernon
./algernon --cache=images -s samples :443
Then in another window ("Hello, Lua!" is the reply I got back from the server):
curl -k 'https://localhost/lua/'
Hello, Lua!
curl -k 'https://localhost/lua/index.lua'
Hello, Lua!
And then with ./algernon -u --cache=images -s samples :443
, I get the same replies:
curl -k 'https://localhost/lua/'
Hello, Lua!
curl -k 'https://localhost/lua/index.lua'
Hello, Lua!
The same thing happens if I add a test.lua
file and try to download it.
What are the steps to reproduce the issue?
Added a line :
content([=[text/html; charset=utf-8]=]);
fixed it. weired.
Declaring the content type at the top of a Lua script with a call to content
is a good practice, but the lack of one should not cause the contents of the Lua script to be downloaded. If this happens, it's a bug, and I would very much like to fix it.
algernon/samples/index.lua
only contains print("Hello, Lua!")
, and the file is not downloaded. If I change it to something else like 2+3
, the file is not downloaded either.
Please include the steps to reproduce the issue.
Finally, I know why .
If I put -u
at the first arg of arglist
algernon -u --cache=images --redis=localhost:6379 -s /root/owrt_www :443
problem reproduced!
And if I move the -u
to the last of the arglist, everything is fine.
algernon --cache=images --redis=localhost:6379 -s -u /root/owrt_www :443
Maybe the init of Algernon is too complex without a lua script?
What about added a init.lua
for the init of Algernon?
Maybe the init of Algernon is too complex without a lua script? What about added a init.lua for the init of Algernon?
You already proposed init.lua and that has its own merits but not as an imagined decomplication of the command-line flags. Seems like there's just a bug that needs to be fixed.
When running both of these commands, everything works fine here:
./algernon --cache=images -s -u samples :443
./algernon -u --cache=images -s samples :443
Nothing I could find in the source code hints that the order of the -u
flag should matter.
main
branch and building with go build -mod=vendor
?/root/owrt_www
? Unusual permissions, uppercase filenames or unusual unicode symbols?Please provide steps that I can follow to reproduce the issue here. I don't have /root/owrt_www
and the files that are there.
- go build -mod=vendor
DEBUG SITE
Click Hello Lua
will download a lua-file;
Click Counter
is OK.
Updated algernon from github and rebuld it with go build -mod=vendor
.
algernon --cache=images --redis=localhost:6379 -s -u /root/owrt_www :443
DEBUG SITE
The samples
is the same as algernon/samples
from the source code.
Why?
Added
content([=[text/html; charset=utf-8]=]);
to /samples/permissions/index.lua at line 0
fixed the download file
problem.
Maybe added a checking for any http-response head missing content key
and added
content: "text/html; charset=utf-8"
as default
?
Update: change browser from chrome to safari, and problem disappeared.
Update: change browser from chrome to safari, and problem disappeared.
Safari donnot connect to my site with QUIC.
So the -u
option is the root cause.
I have try to remove -u
and the chrome also work .
What happened?
/root/owrt_www
? Unusual permissions, uppercase filenames or unusual unicode symbols?/root/owrt_www
, if possible.I will try reproducing the issue in Chrome as well.
- Is there anything unusual about the Lua files in
/root/owrt_www
? Unusual permissions, uppercase filenames or unusual unicode symbols?- Please provide steps to reproduce the issue that will also work on systems that don't have
/root/owrt_www
, if possible.I will try reproducing the issue in Chrome as well.
You're right. When some bad-thing happened in a non-debug-mode algernon, it will triger a download .
algernon --cache=images --redis=localhost:6379 -s /root/owrt_www :443 is OK. algernon -u --cache=images --redis=localhost:6379 -s /root/owrt_www :443 will make *.lua can be downloaded. @ current master code