Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def generate_files(path, items)
- trail = path.split("/")
- return "" if trail.length < 2
- files = ""
- items.each do |f, hide|
- h = hide ? '1' : '0'
- files << <<-FILES
- <D:response xmlns:lp1="DAV:" xmlns:lp2="http://apache.org/dav/props/">
- <D:href>#{path}#{f}</D:href>
- <D:propstat>
- <D:prop>
- <lp1:resourcetype/>
- <lp1:creationdate>#{gen_datestamp}</lp1:creationdate>
- <lp1:getcontentlength>#{rand(0x10000)+120}</lp1:getcontentlength>
- <lp1:getlastmodified>#{gen_timestamp}</lp1:getlastmodified>
- <lp1:getetag>"#{"%.16x" % rand(0x100000000)}"</lp1:getetag>
- <lp2:executable>T</lp2:executable>
- <D:supportedlock>
- <D:lockentry>
- <D:lockscope><D:exclusive/></D:lockscope>
- <D:locktype><D:write/></D:locktype>
- </D:lockentry>
- <D:lockentry>
- <D:lockscope><D:shared/></D:lockscope>
- <D:locktype><D:write/></D:locktype>
- </D:lockentry>
- </D:supportedlock>
- <D:lockdiscovery/>
- <D:getcontenttype>application/octet-stream</D:getcontenttype>
- </D:prop>
- <D:status>HTTP/1.1 200 OK</D:status>
- <D:ishidden b:dt="boolean">#{h}</D:ishidden>
- </D:propstat>
- </D:response>
- FILES
- end
- files = files.gsub(/^\t\t\t/, '')
- return files
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement