175 #include <http_core.h>
180 #ifdef HAVE_SETLOCALE
183 #ifdef HAVE_SYS_TIME_H
184 #include <sys/time.h>
187 #ifdef BUILD_FOR_APACHE2
189 static const char *handlers[] = {
195 "application/x-flac",
201 #include <http_main.h>
204 #ifdef ENABLE_OUTPUT_ARCHIVE
218 const char* user_agent = NULL;
221 return strstr(user_agent,
"MSIE") && 1;
247 #ifdef HAVE_GETTIMEOFDAY
248 struct timeval tvend;
249 gettimeofday(&tvbegin, NULL);
252 r->allowed |= ((1 << M_GET) | (1 << M_POST));
258 #ifdef BUILD_FOR_APACHE2
259 if(!r->handler || strcmp(r->handler, DIR_MAGIC_TYPE))
265 if (access(r->filename, R_OK|X_OK) != 0) {
266 mi_rerror(
"Can't open directory: %s", r->filename);
267 return HTTP_FORBIDDEN;
272 if (r->uri[0] ==
'\0' || r->uri[strlen(r->uri) - 1] !=
'/') {
275 file =
apr_pstrcat(r->pool, ap_escape_uri(r->pool, r->uri),
276 "/",
"?", r->args, NULL);
278 file =
apr_pstrcat(r->pool, ap_escape_uri(r->pool, r->uri),
281 apr_table_setn(r->headers_out,
"Location", ap_construct_url(r->pool, file, r));
282 return HTTP_MOVED_PERMANENTLY;
286 switch (r->method_number) {
304 return HTTP_MOVED_TEMPORARILY;
340 char content_disposition[64] =
"";
342 strcat(content_disposition,
"attachment; ");
344 strcat(content_disposition,
"filename=\"playlist.m3u\"");
347 apr_table_set(r->headers_out,
"Content-Disposition", content_disposition);
350 #ifdef ENABLE_OUTPUT_ARCHIVE
352 const ssize_t tballsize =
tarball_size(r, &master_pack);
355 "filename = \"playlist.tar\"");
378 ap_send_http_header(r);
383 #ifdef HAVE_GETTIMEOFDAY
385 gettimeofday(&tvend, NULL);
386 timersub(&tvend, &tvbegin, &tvprocess);
394 #ifdef ENABLE_OUTPUT_ARCHIVE
423 #ifdef BUILD_FOR_APACHE2
424 register unsigned short i;
431 #ifdef BUILD_FOR_APACHE2
436 for (i=0; handlers[i] && strcmp(r->handler, handlers[i]); i++);
438 if (handlers[i] == NULL)
462 if (r->args && !strcmp(r->args,
"stream")) {
465 "filename = \"playlist.m3u\"");
467 ap_send_http_header(r);
492 if (r->args && !strcmp(r->args,
"stream")) {
504 return HTTP_FORBIDDEN;
507 #ifndef BUILD_FOR_APACHE2
518 #ifdef HAVE_SETLOCALE
519 setlocale(LC_ALL,
"");
521 textdomain(
"mod_musicindex");
522 bind_textdomain_codeset(
"mod_musicindex",
"UTF-8");
544 STANDARD_MODULE_STUFF,
578 #ifdef HAVE_SETLOCALE
579 setlocale(LC_ALL,
"");
581 textdomain(
"mod_musicindex");
582 bind_textdomain_codeset(
"mod_musicindex",
"UTF-8");
594 static const char *
const after[] = {
"mod_autoindex.c", NULL };
601 STANDARD20_MODULE_STUFF,