lib/roda/plugins/public.rb
def public_serve_compressed(server, path, suffix, encoding)
          if env['HTTP_ACCEPT_ENCODING'] =~ /\b#{encoding}\b/
            compressed_path = path + suffix

            if public_file_readable?(compressed_path)
              res = public_serve(server, compressed_path)
              headers = res[1]

              unless res[0] == 304
                headers['Content-Type'] = ::Rack::Mime.mime_type(::File.extname(path), 'text/plain')
                headers['Content-Encoding'] = encoding
              end

              halt res
            end
          end
        end
# Serve files from the public directory if the file exists and this is a GET request.
Serve files from the public directory if the file exists and this is a GET request.
Serve files from the public directory if the file exists and this is a GET request .
def public_serve_compressed(server, path, suffix, encoding)
          if env['HTTP_ACCEPT_ENCODING'] =~ /\b#{encoding}\b/
            compressed_path = path + suffix
            if public_file_readable?(compressed_path)
              res = public_serve(server, compressed_path)
              headers = res[1]
              unless res[0] == 304
                headers['Content-Type'] = ::Rack::Mime.mime_type(::File.extname(path), 'text/plain')
                headers['Content-Encoding'] = encoding
              end
              halt res
            end
          end
        end
def public_serve_compressed ( server , path , suffix , encoding ) if env [ 'HTTP_ACCEPT_ENCODING' ] =~ / \b #{ encoding } \b / compressed_path = path + suffix if public_file_readable? ( compressed_path ) res = public_serve ( server , compressed_path ) headers = res [ 1 ] unless res [ 0 ] == 304 headers [ 'Content-Type' ] = :: Rack :: Mime . mime_type ( :: File . extname ( path ) , 'text/plain' ) headers [ 'Content-Encoding' ] = encoding end halt res end end end
Serve files from the public directory if the file exists and this is a GET request.
Serve files from the public directory if the file exists and this is a GET request .
server
path
suffix
encoding