[api] remove X-Device form the POST header
This commit is contained in:
parent
b157a5dc72
commit
7e37088e7d
|
@ -66,9 +66,6 @@ check_token(_, _) ->
|
||||||
check_digest(Digest) ->
|
check_digest(Digest) ->
|
||||||
check_hex(Digest, 40).
|
check_hex(Digest, 40).
|
||||||
|
|
||||||
check_device(Device) ->
|
|
||||||
check_hex(Device, 32).
|
|
||||||
|
|
||||||
check_hex(String, Length) ->
|
check_hex(String, Length) ->
|
||||||
case re:run(String, "[0-9a-f]+", []) of
|
case re:run(String, "[0-9a-f]+", []) of
|
||||||
{match, [{0, Length}]} -> {String, true};
|
{match, [{0, Length}]} -> {String, true};
|
||||||
|
|
|
@ -49,15 +49,13 @@ malformed_request(ReqData, State) ->
|
||||||
malformed_POST(ReqData, _State) ->
|
malformed_POST(ReqData, _State) ->
|
||||||
{_Version, ValidVersion} = check_version(wrq:get_req_header("X-Version", ReqData)),
|
{_Version, ValidVersion} = check_version(wrq:get_req_header("X-Version", ReqData)),
|
||||||
{RrdSensor, ValidSensor} = check_sensor(wrq:path_info(sensor, 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)),
|
{Digest, ValidDigest} = check_digest(wrq:get_req_header("X-Digest", ReqData)),
|
||||||
|
|
||||||
State = #state{rrdSensor = RrdSensor,
|
State = #state{rrdSensor = RrdSensor,
|
||||||
device = Device,
|
|
||||||
digest = Digest},
|
digest = Digest},
|
||||||
|
|
||||||
{case {ValidVersion, ValidSensor, ValidDevice, ValidDigest} of
|
{case {ValidVersion, ValidSensor, ValidDigest} of
|
||||||
{true, true, true, true} -> false;
|
{true, true, true} -> false;
|
||||||
_ -> true
|
_ -> true
|
||||||
end,
|
end,
|
||||||
ReqData, State}.
|
ReqData, State}.
|
||||||
|
|
Loading…
Reference in New Issue