Re: Bug in netrw.vim

2006-10-07 Thread A.J.Mechelynck

Victor Hsieh wrote:

That is exactly what I think.

In most cast, http server and ftp server doesn't share the same PATH
(I mean, http,ftp://somewhere/PATH).  Consider about this case, if I
tried to edit http://somewhere/~victor/ , and my vim opened
ftp://somewhere/~victor/ instead, it's not gonna work at all.  There
is natrually difference between PROTOCOLs, simple mapping can be
wrong.

Regards,
Victor


Yeah. http://ftp.vim.org/pub/vim/ and ftp://ftp.vim.org/pub/vim/ or 
http://ftp.mozilla.org/pub/mozilla.org/ and 
ftp://ftp.mozilla.org/pub/mozilla.org/ are equivalent; but the ftp server I 
access to upload something at http://users.skynet.be/antoine.mechelynck/ is 
just ftp://users.skynet.be/ with an 8-character alphanumeric username and a 
password. I will venture that in general, simple mapping will be wrong.



Best regards,
Tony.


Bug in netrw.vim

2006-10-06 Thread Victor Hsieh

Hi,

With vim 7.0 and netrw.vim version 98,  I've encountered a problem
when trying to vim http://somewhere/file.txt;.  This patch will fix
the problem:


--- netrw.vim   2006-10-06 13:53:03.567758750 +0800
+++ netrw.vim.orig  2006-10-06 13:47:02.757209500 +0800
@@ -753,7 +753,7 @@
call tar#Browse(tfile)
   else
 call Decho(edit temporary file)
-e
+e!
   endif

rename buffer back to remote filename


BTW, when I try to vim http://somewhere/dir/; (with slash at the
end), it'll try to connect to ftp://somewhere/dir/ instead of returned
html.  If you look at netrw.vim, there's a snippet of code like this:

 if method == ftp || method == http
  let method  = ftp
  let listcmd = g:netrw_ftp_list_cmd
 else
  let listcmd = substitute(g:netrw_list_cmd,'\HOSTNAME\',user.machine,'')
 endif

If you remove the second line, everything is gonna be all right, even
the returned html code is parsed and vim will list the remote file
correctly.  Does anybody know what's the second line for?

Help appreciated.

Regards,
Victor


Re: Bug in netrw.vim

2006-10-06 Thread Charles E Campbell Jr
Victor Hsieh wrote: 



With vim 7.0 and netrw.vim version 98,  I've encountered a problem
when trying to vim http://somewhere/file.txt;.  This patch will fix
the problem:


By the way, netrw is up to version 107a on my website.  If you have a 
problem
with netrw, its always best to get the latest version from my website 
and see if
the problem has already been addressed (although e is still being used 
rather
than e! in v107a).  My website is:  
http://mysite.verizon.net/astronaut/vim/index.html#VimFuncs

(see Network Oriented Reading, Writing, and Browsing for netrw).

Regards,
Chip Campbell



Re: Bug in netrw.vim

2006-10-06 Thread Charles E Campbell Jr

Victor Hsieh wrote:


On 10/6/06, Charles E Campbell Jr [EMAIL PROTECTED] wrote:


Victor Hsieh wrote:
 With vim 7.0 and netrw.vim version 98,  I've encountered a problem
 when trying to vim http://somewhere/file.txt;.  This patch will fix
 the problem:
This would silently let users overwrite their own work that they had not
saved.
I don't think this would be a good idea.


In this case, explicitly open the url via vim http://...; can  be
detected, and there's no more risk.  I suppose this is a possible
solution :)


Again, its not a good idea.  Presumably the problem occurred because you
edited the page.  OK, so what I will do is make files obtained with the
http://... format show up as readonly.  At least you'll get an earlier 
notice

that editing such files isn't a Good Idea.




Netrw uses the trailing slash to determine whether to browse the remote
directory
or to bring it up for editing.  Consider  ftp://hostname/some/directory/
-- that trailing
slash tells netrw to display directory contents, not attempt to edit a
file called directory.

Now, http://... normally uses wget, and there's no corresponding wput;
hence, editing
an http://... url is a read-only operation.   So, if one tries to edit a
directory with the
http protocol (ie. wget), netrw does the best it can and brings it up
using ftp.  Of course,
ftp is a read and write capable protocol, so one can really edit it.


I know.  But I just want to read the html code or so with my favoriate
editor ;)  I used to do it with vim6.  Actually in most case,
connecting to ftp://somewhere (when open http://somewhere) is not
gonna work.


Not if you don't have the username/password access to the site, 'tis true.
I've put a no-browsing exception in for http://... .
Please try v107b now on my website:

 http://mysite.verizon.net/astronaut/vim/index.html#VimFuncs
 see Network Oriented Reading, Writing, and Browsing

Regards,
Chip Campbell



Re: Bug in netrw.vim

2006-10-06 Thread A.J.Mechelynck

Victor Hsieh wrote:

On 10/6/06, Charles E Campbell Jr [EMAIL PROTECTED] wrote:

Victor Hsieh wrote:
 With vim 7.0 and netrw.vim version 98,  I've encountered a problem
 when trying to vim http://somewhere/file.txt;.  This patch will fix
 the problem:
This would silently let users overwrite their own work that they had not
saved.
I don't think this would be a good idea.

In this case, explicitly open the url via vim http://...; can  be
detected, and there's no more risk.  I suppose this is a possible
solution :)


Netrw uses the trailing slash to determine whether to browse the remote
directory
or to bring it up for editing.  Consider  ftp://hostname/some/directory/
-- that trailing
slash tells netrw to display directory contents, not attempt to edit a
file called directory.

Now, http://... normally uses wget, and there's no corresponding wput;
hence, editing
an http://... url is a read-only operation.   So, if one tries to edit a
directory with the
http protocol (ie. wget), netrw does the best it can and brings it up
using ftp.  Of course,
ftp is a read and write capable protocol, so one can really edit it.

I know.  But I just want to read the html code or so with my favoriate
editor ;)  I used to do it with vim6.  Actually in most case,
connecting to ftp://somewhere (when open http://somewhere) is not
gonna work.


Regards,
Chip Campbell


Regards,
Vicotr



http://www.example.com/something/

gives you (usually) the default file in the specified directory. Depending on 
how the http server is configured, you could get anything. Far from always a 
directory listing: e.g., on user sites at my ISP (Belgacom Skynet), if there 
is a file named index.html, INDEX.HTML, index.htm or INDEX.HTM you get that, 
and if there isn't you are redirected to some Skynet portal. Try the following:


http://users.skynet.be/antoine.mechelynck/
you get index.htm (my Welcome page) but the headers don't
say so
http://users.skynet.be/antoine.mechelynck/other/
you are redirected first to a page asking you to choose
French or Dutch language, and then to the Skynet homepage
http://users.skynet.be/antoine.mechelynck/other/imbecile.htm
you get a real HTML page, with Idiots annoy me in
a variety of languages (i.e. the directory exists).

OTOH,

ftp://www.example.com/something/

(when given to a browser) gives you an FTP directory listing of directory 
/something/ at the FTP site www.example.com  (provided that there is an FTP 
server at that address). Depending on the server, anonymous FTP may or may not 
be possible.



Best regards,
Tony.


Re: Bug in netrw.vim

2006-10-06 Thread A.J.Mechelynck

Charles E Campbell Jr wrote:

Victor Hsieh wrote:

[...]

I know.  But I just want to read the html code or so with my favoriate
editor ;)  I used to do it with vim6.  Actually in most case,
connecting to ftp://somewhere (when open http://somewhere) is not
gonna work.


Not if you don't have the username/password access to the site, 'tis true.

[...]

Also not if there is no FTP server at that address.

Many FTP servers can be accessed read-only by HTTP; but most HTTP servers have 
no FTP counterpart AFAIK.



Best regards,
Tony.


Re: Bug in netrw.vim

2006-10-06 Thread mwoehlke

A.J.Mechelynck wrote:

Charles E Campbell Jr wrote:

Victor Hsieh wrote:

[...]

I know.  But I just want to read the html code or so with my favoriate
editor ;)  I used to do it with vim6.  Actually in most case,
connecting to ftp://somewhere (when open http://somewhere) is not
gonna work.


Not if you don't have the username/password access to the site, 'tis 
true.

[...]

Also not if there is no FTP server at that address.

Many FTP servers can be accessed read-only by HTTP; but most HTTP 
servers have no FTP counterpart AFAIK.


Many? Like Victor, I would have said most. In fact, other than 
software mirrors (gnu.org and the like) I think it's pretty rare to have 
a site where http and ftp are mirrors of each other (my web host, for 
instance, gives me a chroot'd environment when I log into ftp, so even 
though they have both, they are not symmetric). And most sites (e.g. 
google.com) don't have ftp at all.


Trying ftp://somewhere when http://somewhere doesn't work *might* work 
1% of the time. I would say http:// should be treated read-only, since 
it almost always is, and the few cases where it isn't span a wide 
variety of /ways/ in which it isn't.


--
Matthew
What's Cygwin? you ask.
'Tis mostly absurd software
Concerning hippos.



Re: Bug in netrw.vim

2006-10-06 Thread Victor Hsieh

That is exactly what I think.

In most cast, http server and ftp server doesn't share the same PATH
(I mean, http,ftp://somewhere/PATH).  Consider about this case, if I
tried to edit http://somewhere/~victor/ , and my vim opened
ftp://somewhere/~victor/ instead, it's not gonna work at all.  There
is natrually difference between PROTOCOLs, simple mapping can be
wrong.

Regards,
Victor

On 10/7/06, mwoehlke [EMAIL PROTECTED] wrote:

A.J.Mechelynck wrote:
 Charles E Campbell Jr wrote:
 Victor Hsieh wrote:
 [...]
 I know.  But I just want to read the html code or so with my favoriate
 editor ;)  I used to do it with vim6.  Actually in most case,
 connecting to ftp://somewhere (when open http://somewhere) is not
 gonna work.

 Not if you don't have the username/password access to the site, 'tis
 true.
 [...]

 Also not if there is no FTP server at that address.

 Many FTP servers can be accessed read-only by HTTP; but most HTTP
 servers have no FTP counterpart AFAIK.

Many? Like Victor, I would have said most. In fact, other than
software mirrors (gnu.org and the like) I think it's pretty rare to have
a site where http and ftp are mirrors of each other (my web host, for
instance, gives me a chroot'd environment when I log into ftp, so even
though they have both, they are not symmetric). And most sites (e.g.
google.com) don't have ftp at all.

Trying ftp://somewhere when http://somewhere doesn't work *might* work
1% of the time. I would say http:// should be treated read-only, since
it almost always is, and the few cases where it isn't span a wide
variety of /ways/ in which it isn't.

--
Matthew
What's Cygwin? you ask.
'Tis mostly absurd software
Concerning hippos.