On Fri, Dec 14, 2001 at 12:55:25PM +0300, Alexander V. Lukyanov wrote:
> But some of these are links to directories. Directories are different,
> since a trailing slash should be added in http request. I was thinking
> about a flag cwd_is_file, but has not implemented that yet.
And that would break "cd .." if you CD to another file (you'd only
have "cd - ".)
Not related:
Here's a patch to add Http::ParseLongList(). We work out of cache more
often with HTTP. This also fixes my own mildly broken HTTP server: it
sends redirects instead of 404s, so the directory test breaks--it
interprets the redirection as a success and tries to list it with a
trailing slash. (It redirects to a valid page, too; a real 404 is never
sent. Something on my own list of things to fix ...) Now IsDirectory
works in the case where a parent page is cached.
I'm still using the ftp takeover code; I can't find anything wrong with
it. I've improved it a bit more: FileAccess.cc doesn't reset the
priority to 0 on Reuse(), so an idle session's priority is its last
priority. GetBetterConnection() only delays if the last priority is
greater than its own. So, if a background job is reusing a job that was
last used by a foreground job, it delays; but if the last job that used
it was a background job, it doesn't. This prevents an extra second
delay between every queued command; so neither
queue mkdir a
queue mkdir b
queue mkdir c
queue mkdir d
queue mkdir e
nor
lftp 0:~> mkdir x ftp://0/y
delay at all.
--
Glenn Maynard
Index: Http.h
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/Http.h,v
retrieving revision 1.36
diff -u -r1.36 Http.h
--- Http.h 2001/12/05 15:03:43 1.36
+++ Http.h 2001/12/15 03:09:05
@@ -132,6 +132,7 @@
FileAccess *Clone() { return new Http(this); }
static FileAccess *New();
+ FileSet *ParseLongList(const char *buf,int len,int *err=0);
int Do();
int Done();
Index: HttpDir.cc
===================================================================
RCS file: /home/lav/cvsroot/lftp/src/HttpDir.cc,v
retrieving revision 1.68
diff -u -r1.68 HttpDir.cc
--- HttpDir.cc 2001/12/05 15:03:43 1.68
+++ HttpDir.cc 2001/12/15 03:09:06
@@ -1087,6 +1087,23 @@
return m;
}
+FileSet *Http::ParseLongList(const char *buf,int len,int *err=0)
+{
+ FileSet *set=new FileSet;
+ ParsedURL prefix(GetConnectURL());
+ char *base_href=0;
+ for(;;)
+ {
+ int n=parse_html(buf,len,true,0,set,0,&prefix,&base_href);
+ if(n==0)
+ break;
+ buf+=n;
+ len-=n;
+ }
+ xfree(base_href);
+ return set;
+}
+
HttpDirList::HttpDirList(ArgV *a,FileAccess *fa)
: DirList(a)
{
@@ -1160,17 +1177,5 @@
// HttpListInfo implementation
FileSet *HttpListInfo::Parse(const char *b,int len)
{
- FileSet *set=new FileSet;
- ParsedURL prefix(session->GetConnectURL());
- char *base_href=0;
- for(;;)
- {
- int n=parse_html(b,len,true,0,set,0,&prefix,&base_href);
- if(n==0)
- break;
- b+=n;
- len-=n;
- }
- xfree(base_href);
- return set;
+ return session->ParseLongList(b, len);
}