http_page_file.cdc~

./src/http_page_file.cdc~ · 405 B

From the archive cold-turkey.tar.gz

Download the archive   « Back to the archive contents

new object $http_page_file: $http_page;

var $root inited = 1;

public method .GET() {
  arg page, args;
  var file, text;

  catch ~filenf {
    file = $file.open(args);
  } with {
    return $http_lib.error(404, args + " could not be found on this server.");
  }
  text = file.readlines();
  file.close();

  // Now add the header
  return [200, [["Content-type", $mime_lib.mime_type(args)]], text];
};

Site Stats

Snippets: 1791
Codebases: 571