edgexfoundry / device-usb-camera

Owner: Device WG
Apache License 2.0
12 stars 28 forks source link

fix: add return on empty user/pass, and do not send superfluous 200 OK #247

Closed ajcasagrande closed 1 year ago

ajcasagrande commented 1 year ago

There was a missing return statement in the section that checks if the username or password is empty. Also, warning messages were present that would say superfluous WriteHeader for 200 OK.

If your build fails due to your commit message not passing the build checks, please review the guidelines here: https://github.com/edgexfoundry/edgex-go/blob/main/.github/Contributing.md

PR Checklist

Please check if your PR fulfills the following requirements:

Testing Instructions

Build and run this PR using Debug Logging. Fill out credentials for user/pass for rtsp server Call Start Streaming API Expect the logs:

level=DEBUG app=device-usb-camera source=driver.go:194 msg="rtsp authentication: username or password is empty"
level=DEBUG app=device-usb-camera source=driver.go:220 msg="rtsp authentication: passwords match"

New Dependency Instructions (If applicable)

vyshali-chitikeshi commented 1 year ago

Validation looks good. With rtsp user name and password, streaming starts successfully and get below msgs in log level=DEBUG ts=2023-05-16T00:12:44.735054278Z app=device-usb-camera source=driver.go:194 msg="rtsp authentication: username or password is empty" level=DEBUG ts=2023-05-16T00:12:44.782961748Z app=device-usb-camera source=driver.go:220 msg="rtsp authentication: passwords match"

Without rtsp user name/password (or empty credentials), start streaming fails and get below msgs in log level=DEBUG ts=2023-05-16T00:11:16.539368151Z app=device-usb-camera source=driver.go:194 msg="rtsp authentication: username or password is empty" level=DEBUG ts=2023-05-16T00:11:16.58683335Z app=device-usb-camera source=driver.go:194 msg="rtsp authentication: username or password is empty"