28 VirtualFileMountHTTP::
29 VirtualFileMountHTTP(
const URLSpec &root, HTTPClient *http) :
35 string path = _root.get_path();
36 if (!path.empty() && path[path.length() - 1] !=
'/') {
45 VirtualFileMountHTTP::
46 ~VirtualFileMountHTTP() {
59 void VirtualFileMountHTTP::
60 reload_vfs_mount_url() {
65 while (n < vfs->get_num_mounts()) {
67 if (mount->is_of_type(VirtualFileMountHTTP::get_class_type())) {
78 PRC_DESC(
"vfs-mount-url http://site/path[:port] mount-point [options]"));
80 int num_unique_values = mounts.get_num_unique_values();
81 for (
int i = 0; i < num_unique_values; i++) {
82 string mount_desc = mounts.get_unique_value(i);
84 size_t space = mount_desc.rfind(
' ');
85 if (space == string::npos) {
86 downloader_cat.warning()
87 <<
"No space in vfs-mount-url descriptor: " << mount_desc <<
"\n";
90 string mount_point = mount_desc.substr(space + 1);
91 while (space > 0 && isspace(mount_desc[space - 1])) {
94 mount_desc = mount_desc.substr(0, space);
97 space = mount_desc.rfind(
' ');
98 if (space != string::npos) {
100 options = mount_point;
101 mount_point = mount_desc.substr(space + 1);
102 while (space > 0 && isspace(mount_desc[space - 1])) {
105 mount_desc = mount_desc.substr(0, space);
116 size_t q = options.find(
',', p);
117 while (q != string::npos) {
121 q = options.find(
',', p);
126 vfs->
mount(mount, mount_point, flags);
134 bool VirtualFileMountHTTP::
143 bool VirtualFileMountHTTP::
144 is_directory(
const Filename &)
const {
152 bool VirtualFileMountHTTP::
153 is_regular_file(
const Filename &)
const {
164 make_virtual_file(
const Filename &local_filename,
165 const Filename &original_filename,
bool implicit_pz_file,
167 PT(VirtualFileHTTP) vfile =
168 new VirtualFileHTTP(
this, local_filename, implicit_pz_file, open_flags);
169 vfile->set_original_filename(original_filename);
179 std::istream *VirtualFileMountHTTP::
180 open_read_file(
const Filename &)
const {
189 std::streamsize VirtualFileMountHTTP::
190 get_file_size(
const Filename &, std::istream *)
const {
198 std::streamsize VirtualFileMountHTTP::
199 get_file_size(
const Filename &)
const {
213 time_t VirtualFileMountHTTP::
214 get_timestamp(
const Filename &)
const {
223 bool VirtualFileMountHTTP::
224 scan_directory(vector_string &,
const Filename &)
const {
231 void VirtualFileMountHTTP::
232 output(std::ostream &out)
const {
240 PT(HTTPChannel) VirtualFileMountHTTP::
242 PT(HTTPChannel) channel;
243 _channels_lock.lock();
245 if (!_channels.empty()) {
249 channel = _channels.back();
250 _channels.pop_back();
253 channel = _http->make_channel(
true);
256 _channels_lock.unlock();
265 void VirtualFileMountHTTP::
266 recycle_channel(HTTPChannel *channel) {
267 _channels_lock.lock();
268 _channels.push_back(channel);
269 _channels_lock.unlock();
272 #endif // HAVE_OPENSSL PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A container for a URL, e.g.
A hierarchy of directories and files that appears to be one continuous file system, even though the files may originate from several different sources that may not be related to the actual OS's file system.
The abstract base class for a file or directory within the VirtualFileSystem.
This class is similar to ConfigVariable, but it reports its value as a list of strings.
bool mount(Multifile *multifile, const Filename &mount_point, int flags)
Mounts the indicated Multifile at the given mount point.
The name of a file, such as a texture file or an Egg file.
static std::string expand_string(const std::string &str)
Reads the string, looking for environment variable names marked by a $.
static VirtualFileSystem * get_global_ptr()
Returns the default global VirtualFileSystem.
int unmount(Multifile *multifile)
Unmounts all appearances of the indicated Multifile from the file system.
static void parse_option(const std::string &option, int &flags, std::string &password)
Parses one of the option flags in the options list on the vfs-mount Config.prc line.
The abstract base class for a mount definition used within a VirtualFileSystem.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_mount
Returns the nth mount in the system.
TypeHandle is the identifier used to differentiate C++ class types.