小编cod*_*543的帖子

Dart HttpServer 耗尽堆空间

我一直在修改一些示例代码以用于 Web 服务器,这样我就可以在服务器和客户端上运行 dart。但是,我决定要检查 Web 服务器的性能,除了崩溃之外,我印象最深刻。我在 Ubuntu 上使用“siege”包,使用少量 URL 为网站生成大量流量。

我已经看到它每秒传输 1000 个事务,这对我来说是非常可接受的,但是在运行两到三分钟后,它要么崩溃要么挂起(如果我增加 new_gen_heap_size)。

#import('dart:io');

class FCServer {

String basePath;

void send404(HttpResponse response)
{
    response.statusCode = HttpStatus.NOT_FOUND;
    response.outputStream.close();
}

void handleRequest(HttpRequest request, HttpResponse response)
{
  final String path = request.path == '/' ? '/index.html' : request.path;
  final File file = new File('${basePath}${path}');
  file.exists().then((bool found) {
      if (found)
      {
          file.fullPath().then((String fullPath) {
              if (!fullPath.startsWith(basePath))
              {
                  send404(response);
              }
              else
              {
                  //print("delivering $fullPath");
                  response.headers.add("Cache-Control", "max-age=3600");
                  //file.openInputStream().pipe(response.outputStream);
                  var file = new File("$fullPath");
                  //response.headers.set(HttpHeaders.CONTENT_TYPE, "$contentType; …
Run Code Online (Sandbox Code Playgroud)

heap httpserver dart

5
推荐指数
1
解决办法
1376
查看次数

保护RAM中的加密密钥?

有没有办法保护存储在RAM中的加密密钥免受冰箱攻击?(在重新启动恶意代码以访问RAM内容之前将计算机挂在冰箱中)

这似乎是我的应用程序中的安全性的合法问题.

编辑:还值得一提的是,我可能会在裸机上做一个概念验证操作系统,所以请记住,依赖性越少越好.然而,TRESOR听起来确实很有趣,如果它看起来可管理,我可能会将其源代码移植到我的概念验证操作系统中,但我对其他解决方案(即使是依赖程度很高的解决方案)持开放态度.

c security encryption cryptography aes

5
推荐指数
1
解决办法
382
查看次数

3
推荐指数
1
解决办法
2988
查看次数