Menu

#20 Null encoding fix and s/-slash-/slash/

closed-fixed
nobody
None
5
2007-04-27
2007-04-09
Lauri Kaila
No

Hi

Here is a small fix for two problems I faced when trying to use my storage from "Saunalahti IsoG" service. Now I can mount and see all file listings, but still can't read the file contents. The modifications:

1. I got segfault from a null encoding value. I just changed it to use UTF-8 in that case.

2. Shell and command line programs got confused by arguments starting with a - hyphen (thought a -s argument was given). So I changed "-slash-" to "slash-" to avoid that problem.

Discussion

  • Lauri Kaila

    Lauri Kaila - 2007-04-09

    webdav.c Null encoding fix and s/-slash-/slash/

     
  • Werner Baumann

    Werner Baumann - 2007-04-10

    Logged In: YES
    user_id=1260327
    Originator: NO

    Hello Lauri,

    thanks for the patch. I added it to the sources in CVS. There is another silly bug in webdav.c, dav_init_webdav, line 229/230:
    instead of

    if (lc_charset != NULL && strcasecmp(lc_charset, "UTF-16") != 0)
    from_utf_8 = iconv_open(lc_charset, "UTF-16");

    it must be

    if (lc_charset != NULL && strcasecmp(lc_charset, "UTF-16") != 0)
    from_utf_16 = iconv_open(lc_charset, "UTF-16");

    (One of my common cut-and-paste-bugs.)

    There will be probably some more bugs of this kind and a bugfix version will be necessary in some weeks.

    Leading slashes:
    I am worried about file names with leading slashes:
    - if the file name is from the displayname propertiy, it is propably o.k.
    - if the file name is from the path (property href), this might be a bug in the code that extracts file names from the path. There have been several issues with this.
    Could you please give me more information about this leading slashes in file names?

    Slash replacement:
    Using hyphen as delimiter for the slash replacement was not a good idea. But if it is not a leading slash, but in the midst of the filename, I would like to have some sort of delimiter. Have you got any better idea. Maybe I will use "slash-" for leading slashes and "-slash-" elsewhere (maybe even "-slash" for trailing slashes?).

    Cheers
    Werner

     
  • Werner Baumann

    Werner Baumann - 2007-04-10
    • status: open --> open-accepted
     
  • Lauri Kaila

    Lauri Kaila - 2007-04-10

    Logged In: YES
    user_id=551967
    Originator: YES

    Hi Werner,

    About the slashes - I'm a webdav newbie so I don't know if they must be allowed filenames. In my case the slash could be stripped away, since it represents the root folder of the remote storage, so the slash isn't part of the file name actually. For example, I have a root level directory "private", and I see it as /mountpoint/slash-private/.

    -lauri

     
  • Werner Baumann

    Werner Baumann - 2007-04-10

    Logged In: YES
    user_id=1260327
    Originator: NO

    Hello Lauri,

    something is going wrong.

    Assume the URL is http://foo.bar/private (or http://foo.bar/private/\), with private beeing your WebDAV repository. There are files file1, file2 and file3 in private. The URLs will be
    http://foo.bar/private/file1
    http://foo.bar/private/file2
    http://foo.bar/private/file3
    If you mount on ~/dav and do
    ~:$ ls dav
    you should get just
    file1
    file2
    file3
    No slashes!

    Could you use wireshark or some other sniffer to get the http traffic?

    There should be a request form davfs2 like

    PROPFIND /private/ HTTP/1.1
    host: foo.bar
    some more headers

    The response should have error code 207 and there should be a XML-Body starting like <?xml ...

    There should also be an OPTIONS request that might be usfull too (it's the first request).

    You might also configure davfs2 with option --enable-debug and there will be a lot of debug messages in one of your log files. This should show the URLs as well as the file names.

    Cheers
    Werner

     
  • Lauri Kaila

    Lauri Kaila - 2007-04-11

    Logged In: YES
    user_id=551967
    Originator: YES

    Hi Werner,

    I will take a dump of the traffic and maybe post it elsewhere as this topic is getting away from this patch. I probably can't do that until the weekend.

    My case is slightly different from what you described. I mount http://foo.bar to /dav and then the root-level directories appear as /dav/slash-directory. I have a feeling that this might be caused by relative urls, ie. being /private instead of http://foo.bar/private. Or someting else.

    Lauri

     
  • Werner Baumann

    Werner Baumann - 2007-04-27
    • status: open-accepted --> closed-fixed
     

Log in to post a comment.