rejetto forum

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - SamePaul

Pages: 1
1
1st of all I hope everything is OK with the author. Seems he just got tired of HFS and this forum a bit :)
Now, good news I have almost ready template that CSS-optimized for both desktop browser and mobile. Yes, not 2 templates - just one :)

But I have some problems on my HTC Desire browser.
1. Browser cannot login via "login" link. Namely when I click link https://my-site.com/~login browser asks me for username and password, but then returns to root folder ... and we're not logged in! Problem is that browser consider "~login" part as folder and thus it thinks that authentication valid only for /~login/ tree. If for example I try to enter password-protected folder https://my-site.com/secure/ I'm asked for password and stay authenticated for this folder and all subfolders as well.
I proposed once to support in HFS alternative authentication URL like https://my-site.com/?mode=auth or even better - support template macro {.setHttpError|code.}. I prefer 2nd solution, as it allows more flexible authentication schemes based on cookies etc.

2. Browser can't download archived content. It means, that if I select multiple files in list and then click "Archive" button, nothing happens. Regular file downloading by clicking link works without any problem.
I analyzed response headers of HFS for different scenarios like archiving files, downloading standalone .tar file. In general difference is in content-type and content-disposition: application/x-tar for archiving and application/octet-stream + "attachment" for downloading. Maybe Android doesn't know how to handle /x-tar or can't live without "attachment" keyword? Maybe it's worth to use 2nd variant for both transfers?
There is also chance that Android can't handle correctly downloading after POST... don't know how to verify this.

3. Uploading isn't working at all. I saw in other post that request header may help in debugging, so here they are
Code: [Select]
> POST /upload/sandbox/ HTTP/1.1
> Host: 192.168.2.100
> Accept-Encoding: gzip
> Accept-Language: en-US
> Cookie: HFS_SID=0.939639982767403
> Accept-Charset: utf-8, iso-8859-1, utf-16, *;q=0.7
> Referer: https://192.168.2.100/upload/sandbox/
> User-Agent: Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; HTC Desire Build/MIUIAndroid 1.5.13) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
> Origin: https://192.182.2.100
> Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
> Authorization: Basic ****************
> Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryKFSXwgyWckAMgljQ
> Content-Length: 554727
Thought it may be use of SSL or authentication, but without it result was the same.
Code: [Select]
> POST /upload/sandbox/ HTTP/1.1
> Host: 192.168.2.100
> Accept-Encoding: gzip
> Accept-Language: en-US
> Cookie: HFS_SID=0.939639982767403
> Accept-Charset: utf-8, iso-8859-1, utf-16, *;q=0.7
> Referer: http://192.168.2.100/upload/sandbox/
> User-Agent: Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; HTC Desire Build/MIUIAndroid 1.5.13) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1
> Origin: http://192.168.2.100
> Accept: application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
> Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryLtRTXXJs6CB4l4hy
> Cache-Control: no-cache
> Pragma: no-cache
> Content-Length: 554727
Comparing to upload from desktop browser
Code: [Select]
> POST /upload/sandbox/ HTTP/1.1
> Host: localhost
> User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
> Accept-Language: en-us,en;q=0.5
> Accept-Encoding: gzip, deflate
> Accept-Charset: windows-1251,utf-8;q=0.7,*;q=0.7
> Keep-Alive: 115
> Connection: keep-alive
> Referer: http://localhost/upload/sandbox/
> Cookie: HFS_SID=0.665004789130762
> Content-Type: multipart/form-data; boundary=---------------------------248749113712
> Content-Length: 108673
The only significant difference I see is "boundary" part, however I'm not very familiar with encoding, but maybe this "WebKitFormBoundary" makes HFS to choke?

UPD: Forgot to mention, HFS Version 2.3 beta 279

2
HTML & templates / MIME-type filter in [file] section
« on: May 17, 2011, 08:11:03 PM »
Hello there :)

As usual I have crazy proposal that potentially may result in more effective and clean template writing.
As long as I know, today in order to handle differently file types (lets say images diferently than music) I have to write something like this

Code: [Select]
[file.jpg=file.jpeg=file.gif=file.png=file.bmp= ...and other 1000 types of image...]
<tr> <td> handle images one way </td> </tr>

[file.mp3=file.m4a=file.aac=file.flac=file.mpc= ...and other 1000 types of audio...]
<tr> <td> handle audio files another way </td> </tr>

[file.avi=file.mkv=file.mp4=file.flv=file.mpg= ...and other 1000 types of video...]
<tr> <td> handle video files third way </td> </tr>

In my example it looks compact but is actually not.
1.  we indeed have thousands of file types for audio/video/pictures/other documents.
2. consider if type-specific section handles only small part of whole HTML code - file icon - but all other attributes are handled uniformly
Code: [Select]
[file=folder]
<tr><td><a href="%item-url%">

[+file.jpg=+file.gif....]
<img src="/images/picture.png">

[+file.avi=+file.mkv....]
<img src="/images/video.png">

[+file=+folder]
</td><td>... all item attributes</td>

[+file.jpg=+file.gif....]
<button onclick="preview('%item-url%')">Preview</button>

[+file.avi=+file.mkv....]
<button onclick="play_flash('%item-url%')">Play</button>

[+file=+folder]
</tr>

Nice feature, isn't? Now consider every section [file.xxx=..] indeed includes many types?

My proposal is as follows. Support for file section like this [file|mime: filter].
For example [file|mime: images/*] would match every images registered in HFS MIME-types list; [file|mime: image/jpeg] would match only JPEG images etc.
This format is just proposal. There are different variants, like [file(image/*)]. This has advantage that it can be used like this: [+file(images/*)=+file(video/*)]

Hope rejetto finds it useful.

3
HFS ~ HTTP File Server / HTTP Error Code
« on: September 30, 2010, 05:13:25 PM »
I'm adopting HFS template to use on mobile browser and encountered some strange quirk.
Some browsers consider path during authentication, so if you authenticate at http://server/some/folder/~login you become logged in for http://server/some/folder/ and deeper. But if after authentication you go to http://server/some/ or http://server/some/other/folder you suddenly discover that browser does not send "Authorization" header anymore. Usually it is not problem, as by default you log in at root folder, i.e. at http://server/~login and hence become logged in for the whole HFS tree. But unfortunately Android browser considers "~login" part as folder, so when after successful authentication you are redirected back to root folder you become unauthorized again. So you are effectively unable to login.
So either you have to restrict access to whole site and thus making anonymous access impossible.
Another solution, which is not available yet, would be to modify HTTP response code within template and switch to corresponding error section like [not found] [overload] [deny] etc.
For example, within template  I could inspect protocol (http, https), cookie or any other condition, and then require user authentication accordingly by setting HTTP code to "401 Unauthorized".

Something like
Code: [Select]
[]
{.if not|{.header|Authorization.}| {: {.http-error|401.} :} .}
<!DOCTYPE...

In this example HFS would set HTTP code to 401 and jumps to [unauthorized] section.

This macro can have optional parameter "no-switch"
Code: [Select]
{.http-error|401|no-switch.}and in this case  HFS just updates error code, but continues to process template normally, i.e. to <!DOCTYPE... and so on.

Code: [Select]
{.http-error|200|no-switch.}is great example of doing nothing :)

4
HFS ~ HTTP File Server / thumbnails on the fly
« on: August 05, 2010, 07:18:57 AM »
I guess it is not really right place to ask question, but can't create new topic.

Anyway, the question is: is there any way to run some program and use it's output as data to be sent to client?
For example, I have pictures gallery and want to show them in with small thumbnails. On regular web-server I would write something like
<a href="pic1.jpeg"><img src="gen_preview.php?file=pic1.jpeg&height=30" />pic1.jpeg</a>

Maybe in HFS template I can do something similar? The ideal would be running utility on the fly and use its output. But if HFS can somehow run utility to generate thumbnail file during HTTP request, it is good too.

Using original size of picture is not an option, because pictures are hi-res and I have relatively narrow upstream. Moreover, cellular traffic is still limited.

5
HFS ~ HTTP File Server / Log options [request]
« on: April 22, 2009, 07:02:50 PM »
1. Option to log Delete attempts and successful deletions. Currently these actions are almost completely ignored. You can see POST but cant' know which file was attempted to delete.
2. Also log filesystem errors. For example if HFS has no access to specified location in VFS or failed to delete something or whatever else. Log these errors too with number and code-to-text translation (the one that comes from FormatMessage or maybe Pascal has own translation)
2. Option to have different set for screen and file logging. For example, I would keep on screen only important things like downloads, uploads, deletions. And in logfile store detailed information about request.

Thank you :)

6
Beta / delete on mount points
« on: April 22, 2009, 03:42:06 PM »
Deletion still doesn't work for me :(
Do you want to publish sources and I will try to find solution? I looked at SF but CVS here is empty and sources are outdated.

7
HFS ~ HTTP File Server / International symbols are treated incorrectly
« on: November 21, 2007, 06:11:40 PM »
As it was discovered there HFS has problem with files that have international symbols in their name and these symbols are from different codepage than system default.
For example, my system codepage is Russian and symbols ö, ä are treated by HFS as o and a. And files having such symbols (02 - Feuerräder.Mp3) are displayed as folders in listing.

HFS is not unicode? :o

8
HFS ~ HTTP File Server / Content caching allowing
« on: August 15, 2007, 06:22:16 PM »
By default HFS specifies in HTTP-headers that content is not cacheable (Cache-Control: no-cache). Whereas I agree on that in general, but for some folders I would *encourage* caching. Is there any way to mark some folder contents to be cached? Not listing, but files themselves?

9
Bug reports / ~files.lst is broken
« on: August 07, 2007, 08:09:44 PM »
~files.lst is broken - displays empty page. Works only with ?recurisve parameter.

No filelist.tpl used. I mean, no such file in HFS directory.

10
HFS ~ HTTP File Server / Security related requests
« on: May 19, 2007, 11:12:44 PM »
I've checked 'TODO' list, but I didn't find some features (maybe I've missed something - sorry for repeat)

- hide folders that currently logged in user is not allowed to access. I believe that less they see - less they will attempt to intrude :)
- limit account to specific subnet. For example I want to create privileged account for local subnet (192.168.X.X) but I don't want this account to be available for external users at all... Well, I thought not about private subnet, but about localhost (127.0.0.1). For SSL, you know  ;D

Pages: 1