MCPcopy Create free account
hub / github.com/apache/mesos / asHttp

Method asHttp

3rdparty/libprocess/src/memory_profiler.cpp:606–624  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

604
605
606http::Response MemoryProfiler::DiskArtifact::asHttp() const
607{
608 // If we get here, we want to serve the file that *should* be on disk.
609 // Verify that it still exists before attempting to serve it.
610 //
611 // TODO(bevers): Store a checksum and verify that it matches.
612 if (!os::stat::isfile(path)) {
613 return http::BadRequest("Requested file was deleted from local disk.\n");
614 }
615
616 process::http::OK response;
617 response.type = response.PATH;
618 response.path = path;
619 response.headers["Content-Type"] = "application/octet-stream";
620 response.headers["Content-Disposition"] =
621 strings::format("attachment; filename=%s", path).get();
622
623 return std::move(response);
624}
625
626
627Try<MemoryProfiler::DiskArtifact> MemoryProfiler::DiskArtifact::create(

Callers 3

downloadRawProfileMethod · 0.80
downloadGraphProfileMethod · 0.80

Calls 4

BadRequestClass · 0.85
formatFunction · 0.85
isfileFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected