rejetto forum
Software => HFS ~ HTTP File Server => Bug reports => Topic started by: artur on February 03, 2010, 11:25:16 PM
-
Hi,
at first I would like to thank you rejetto for your great work with hfs. And sorry for my bad English, but I hope you will understand me ;)
Now, I think I have found bug in %folder-resource% function. Lets say I have added real folder from hard drive (C:\folder) to vfs (http://localhost/folder/). When I open that folder using web browser, function works perfectly and returns "C:\folder". But if I add/create another folder named new (C:\folder\new) and I open that folder by web broswer (http://localhost/folder/new) function will return "C:\folder ew" (should be C:\folder\new). \n disappears. I'm using HFS 2.3 beta (build 253).
And one more thing. My HFS is "behind" Apache (HFS is running on port 81, Apache on 80). I'm using VirtualHost with reverse_proxy mod and it works perfectly, except one thing: HFS logs only IP address of PC that he is running at (I see in log 2010-02-03 23:41:57 192.168.1.202:2565 Requested GET /, and IP address of server in local network is 192.168.1.202). I'm using {.add to log |{.header|X-Forwarded-For.}.} to see incoming ip's, but it makes log hard to read. Is it possible to modify log and for example give choice what IP should logged (that from request or that stored in header in X-Forwarded-For)?
Thank you,
Artur.
-
Now, I think I have found bug in %folder-resource% function. Lets say I have added real folder from hard drive (C:\folder) to vfs (http://localhost/folder/). When I open that folder using web browser, function works perfectly and returns "C:\folder". But if I add/create another folder named new (C:\folder\new) and I open that folder by web broswer (http://localhost/folder/new) function will return "C:\folder ew" (should be C:\folder\new). \n disappears. I'm using HFS 2.3 beta (build 253).
to obtain more information about, can you doing the same test by using \view instead of \new , it is to know if the \n is replaced in internal by a CRLF
thanks for reporting ;)
-
it is the \n for sure
i will make some test ASAP
-
i have doing this test
c:\
|- folder
|- new
|- view
folder added to the vfs as real
in to properties : diff template inersted %folder-resource%
results are for /folder , /folder/new and /folder/view
C:\folder
C:\folder\
ew
C:\folder\view
confimed: \n is replaced by a CRLF
%folder-ressource% seem defined correctly , but between the moment, he is replaced by the resource and the web result, there is a HIC :D
-
Found why: the bug come from here
result:=xtpl(result, [
'\n', CRLF,
'%build-time%', floatToStrF((now()-buildTime)*SECONDS, ffFixed, 7,3)
]);
i see no solution, exept removing the red line
adding a space after \n is doing another bug with "c:\folder\n ew-york" :-[
result:=xtpl(result, [
'\n', CRLF,
must be applicated only when and where it is necessary , and not on the full result ;)
one solution is given at this post
http://www.rejetto.com/forum/index.php/topic,8173.msg1048477.html#msg1048477
-
well,
what i don't understand is how this has never been reported before.
the "\n" characters sequence is translated to a newline, because this could be handy, but this way it has more cons than pros.
i will remove this thing for next release (254), and i just hope this won't cause incompatibilities with who used this feature till now.
is anyone aware of current usage of this feature? the default template doesn't use it.
-
one solution is given at this post
http://www.rejetto.com/forum/index.php/topic,8173.msg1048477.html#msg1048477
-
well,
what i don't understand is how this has never been reported before.
the "\n" characters sequence is translated to a newline, because this could be handy, but this way it has more cons than pros.
i will remove this thing for next release (254), and i just hope this won't cause incompatibilities with who used this feature till now.
is anyone aware of current usage of this feature? the default template doesn't use it.
I use it in Events to start a new line in 4 special logs, as text files. Could there be another way
that I could cause them to start a new line?
-
I use it in Events to start a new line in 4 special logs, as text files. Could there be another way that I could cause them to start a new line?
just hit your ENTER key, in place of it, and that should be enough.
if you can't solve this way, post your script and we'll help you.
-
I see you have found solution for \n problem. Nice job Mars and rejetto! I found that accidentally, when because of it I couldn't load files to textarea's in some folders.
But you didn't answered to my second question. I was looking for solution for some time, but found nothing. Is it possible to log IP not only from request, but also from header of that request (X-Forwarded-For). Or maybe there is another way to configure HFS with Apache and give HFS possibility to log right IP?
-
just hit your ENTER key, in place of it, and that should be enough.
if you can't solve this way, post your script and we'll help you.
Events
[file deleted]
\n{.append|/Server/Admin/log_file/Deleted-List.txt|Deleted ; %item-deleted% ; %date% %time% ; %user% ;
.}\nWould the fix even affect the way I'm using "\n" ?
-
yes, it will
you should replace the \n with a real "newline".
better do it now.
-
But you didn't answered to my second question. I was looking for solution for some time, but found nothing. Is it possible to log IP not only from request, but also from header of that request (X-Forwarded-For). Or maybe there is another way to configure HFS with Apache and give HFS possibility to log right IP?
HFS 2.3 supports the x-forwarded-for field.
since the proxy needs to be trusted, by default HFS allows this field just for 127.0.0.1 (localhost).
if your proxy (apache?) is on another machine, you need to edit hfs.ini where the line starts by "forwarded-mask".
a simple way to do this is to run this simple script (menu > debug > run script)
{.set ini|forwarded-mask=127.0.0.1;192.168.* .}
-
yes, it will
you should replace the \n with a real "newline".
better do it now.
Google really didn't show me much.
What is a "real newline" that works for Notepad to replace \n ?
-
Thank you rejetto, works fine. I have to say, you give great support to your program. Nice job!
-
What is a "real newline" that works for Notepad to replace \n ?
solution was in my statement "just hit your ENTER key". ;)
you got a USA flag in your account, so i guess you have a standard american keyboard, with such key.
indeed, by hitting the ENTER key while you are editing a text with notepad, you are putting this http://en.wikipedia.org/wiki/Newline