1 /*
2  * lftp - file transfer program
3  *
4  * Copyright (c) 1996-2012 by Alexander V. Lukyanov (lav@yars.free.net)
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef HTTPDIR_H
21 #define HTTPDIR_H
22 
23 #include "Http.h"
24 #if USE_EXPAT
25 # include <expat.h>
26 #endif
27 
28 class HttpListInfo : public GenericParseListInfo
29 {
30    FileSet *Parse(const char *buf,int len);
31 public:
HttpListInfo(Http * session,const char * path)32    HttpListInfo(Http *session,const char *path)
33       : GenericParseListInfo(session,path)
34       {
35 	 get_time_for_dirs=false;
36       }
37    static FileSet *ParseProps(const char *buf,int len,const char *base_dir);
38 };
39 
40 class ParsedURL;
41 
42 class HttpDirList : public DirList
43 {
44    SMTaskRef<IOBuffer> ubuf;
45    const char *curr;
46    Ref<ParsedURL> curr_url;
47    FileSet all_links;
48    int mode;
49    bool parse_as_html;
50    xstring_c base_href;
51 
52 #if USE_EXPAT
53    XML_Parser xml_p;
54    struct xml_context *xml_ctx;
55 #endif
56 
57    LsOptions ls_options;
58 
59    void ParsePropsFormat(const char *b,int len,bool eof);
60 
61 public:
62    HttpDirList(FileAccess *s,ArgV *a);
63    ~HttpDirList();
64    const char *Status();
65    int Do();
66 
67    void SuspendInternal();
68    void ResumeInternal();
69 };
70 
71 #endif//HTTPDIR_H
72