[api] remove X-Device form the POST header

This commit is contained in:
Bart Van Der Meerssche 2011-03-27 11:22:34 +00:00
parent b157a5dc72
commit 7e37088e7d
2 changed files with 2 additions and 7 deletions

View File

@ -66,9 +66,6 @@ check_token(_, _) ->
check_digest(Digest) ->
check_hex(Digest, 40).
check_device(Device) ->
check_hex(Device, 32).
check_hex(String, Length) ->
case re:run(String, "[0-9a-f]+", []) of
{match, [{0, Length}]} -> {String, true};

View File

@ -49,15 +49,13 @@ malformed_request(ReqData, State) ->
malformed_POST(ReqData, _State) ->
{_Version, ValidVersion} = check_version(wrq:get_req_header("X-Version", ReqData)),
{RrdSensor, ValidSensor} = check_sensor(wrq:path_info(sensor, ReqData)),
{Device, ValidDevice} = check_device(wrq:get_req_header("X-Device", ReqData)),
{Digest, ValidDigest} = check_digest(wrq:get_req_header("X-Digest", ReqData)),
State = #state{rrdSensor = RrdSensor,
device = Device,
digest = Digest},
{case {ValidVersion, ValidSensor, ValidDevice, ValidDigest} of
{true, true, true, true} -> false;
{case {ValidVersion, ValidSensor, ValidDigest} of
{true, true, true} -> false;
_ -> true
end,
ReqData, State}.