reef-pi / drivers

Various sensors, controller and IC drivers for reef-pi
Other
5 stars 17 forks source link

Digital Loggers driver doesn't send all required data in HTTP PUT #86

Closed dmolavi closed 2 years ago

dmolavi commented 2 years ago

In a nutshell, even though the code looks like it includes the 'www-form-urlencoded' header, it doesn't appear to. See the attached screenshot. I've attached 2 screenshots - one of a bad PUT (from reef-pi) and another with a good one, from PostMan. Note how the request is different Screenshot from 2021-12-07 19-17-55 Good_Request .

dmolavi commented 2 years ago

On further inspection, reef-pi does send the www-form-urlencoded attribute, BUT in the authentication portion (which is redacted in my above screenshot), there is a difference. Reef-pi sends: Authorization: Digest username="\<myuser>", realm="\<this matches>", nonce="", uri="/restapi/relay/outlets/1/state/", cnonce="\<value>", nc=value, qop=auth, response="\<value>", opaque="", algorithm="MD5"

The working request sends: Authorization: Digest username="\<myuser>", realm="\<this matches>", nonce="\<value>", uri="/restapi/relay/outlets/1/state/", algorithm="MD5", response="\<value>", opaque="\<value>"

You can see where they differ...I can email you the captures directly if you'd like.

ranjib commented 2 years ago

these values are set from infering the dli response https://github.com/reef-pi/drivers/blob/master/dli/config.go its still not clear why its failing though

dmolavi commented 2 years ago

dli_fix.txt Patch file attached. This should fix it. Works on my DLI switch.

ranjib commented 2 years ago

@dmolavi https://github.com/reef-pi/drivers/pull/87