From bd3e004d7049abe298af4b82f03b423a59ee2021 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sat, 21 Apr 2018 17:28:48 -0700 Subject: [PATCH] modules/client/profile: Duplicate check for client put; extended timeout. --- modules/client/profile.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/client/profile.cc b/modules/client/profile.cc index 21ab18045..82d12cb33 100644 --- a/modules/client/profile.cc +++ b/modules/client/profile.cc @@ -237,6 +237,17 @@ put__profile(client &client, request.user_id }; + profile_get(user, param, [&value] + (const string_view &existing) + { + if(existing == value) + throw m::error + { + http::NOT_MODIFIED, "M_NOT_MODIFIED", + "Profile key '%s' already that value" + }; + }); + const auto eid { profile_set(user, sender, param, value) @@ -253,7 +264,8 @@ method_put { profile_resource, "PUT", put__profile, { - method_put.REQUIRES_AUTH + method_put.REQUIRES_AUTH, + 60s } };