151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
|
# File 'lib/vpim/agent/scraps.rb', line 151
def do_GET(req, resp)
body = ''
folder, include, exclude = *@options
path = req.path_info
all = Dir.entries(folder).select do |f| f =~ /\.ics$/ end
if include
all.reject! do |f| !(f =~ include) end
end
if exclude
all.reject! do |f| f =~ exclude end
end
if(path == '')
body << "<ul>\n"
all.each do |f|
n = f.sub('.ics', '')
body << "<li><a href=\"webcal://#{$host}:#{$port}/calfile/#{f}\">#{n}</a>\n"
end
body << "</ul>\n"
end
resp.body = body
resp['content-type'] = 'text/html'
raise WEBrick::HTTPStatus::OK
end
|