You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ti...@apache.org on 2015/06/24 20:09:08 UTC
[3/8] mesos git commit: Replaced os::dirname and os::basename with
Path::dirname and Path::basename.
Replaced os::dirname and os::basename with Path::dirname and Path::basename.
Review: https://reviews.apache.org/r/34259
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/e2988c4d
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/e2988c4d
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/e2988c4d
Branch: refs/heads/master
Commit: e2988c4dd6d6e7a5e901f26ddbc9d813e5f203a1
Parents: 067079a
Author: Till Toenshoff <to...@me.com>
Authored: Wed Jun 24 19:52:05 2015 +0200
Committer: Till Toenshoff <to...@me.com>
Committed: Wed Jun 24 19:52:05 2015 +0200
----------------------------------------------------------------------
3rdparty/libprocess/src/process.cpp | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/e2988c4d/3rdparty/libprocess/src/process.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/process.cpp b/3rdparty/libprocess/src/process.cpp
index 4f0b281..cd3a191 100644
--- a/3rdparty/libprocess/src/process.cpp
+++ b/3rdparty/libprocess/src/process.cpp
@@ -75,6 +75,7 @@
#include <stout/net.hpp>
#include <stout/option.hpp>
#include <stout/os.hpp>
+#include <stout/path.hpp>
#include <stout/strings.hpp>
#include <stout/synchronized.hpp>
#include <stout/thread.hpp>
@@ -2802,14 +2803,12 @@ void ProcessBase::visit(const HttpEvent& event)
}
// Try and determine the Content-Type from an extension.
- Try<string> basename = os::basename(response.path);
- if (!basename.isError()) {
- size_t index = basename.get().find_last_of('.');
- if (index != string::npos) {
- string extension = basename.get().substr(index);
- if (assets[name].types.count(extension) > 0) {
- response.headers["Content-Type"] = assets[name].types[extension];
- }
+ string basename = Path(response.path).basename();
+ size_t index = basename.find_last_of('.');
+ if (index != string::npos) {
+ string extension = basename.substr(index);
+ if (assets[name].types.count(extension) > 0) {
+ response.headers["Content-Type"] = assets[name].types[extension];
}
}