| 785 | |
| 786 | |
| 787 | Future<http::Response> MemoryProfiler::downloadRawProfile( |
| 788 | const http::Request& request, |
| 789 | const Option<http::authentication::Principal>&) |
| 790 | { |
| 791 | Result<time_t> requestedId = extractIdFromRequest(request); |
| 792 | |
| 793 | // Verify that `id` has the correct version if it was explicitly passed. |
| 794 | if (requestedId.isError()) { |
| 795 | return http::BadRequest( |
| 796 | "Invalid parameter 'id': " + requestedId.error() + ".\n"); |
| 797 | } |
| 798 | |
| 799 | if (currentRun.isSome() && !requestedId.isSome()) { |
| 800 | return http::BadRequest( |
| 801 | "A profiling run is currently in progress. To download results of the" |
| 802 | " previous run, please pass an 'id' explicitly.\n"); |
| 803 | } |
| 804 | |
| 805 | if (rawProfile.isError()) { |
| 806 | return http::BadRequest( |
| 807 | "Cannot access raw profile: " + rawProfile.error() + ".\n"); |
| 808 | } |
| 809 | |
| 810 | // Only requests for the latest available version are allowed. |
| 811 | if (requestedId.isSome() && |
| 812 | (requestedId.get() != rawProfile->getId())) { |
| 813 | return http::BadRequest( |
| 814 | "Cannot serve requested id #" + stringify(requestedId.get()) + ".\n"); |
| 815 | } |
| 816 | |
| 817 | return rawProfile->asHttp(); |
| 818 | } |
| 819 | |
| 820 | |
| 821 | Future<http::Response> MemoryProfiler::downloadSymbolizedProfile( |
nothing calls this directly
no test coverage detected