Skip to content
This repository has been archived by the owner on Jan 15, 2025. It is now read-only.

Better error handling for proxy access mode #33

Merged
merged 1 commit into from
Apr 22, 2017
Merged

Better error handling for proxy access mode #33

merged 1 commit into from
Apr 22, 2017

Conversation

dnsmichi
Copy link
Collaborator

  • use curl_set_opts
  • do not initialize $this->auth with an @ at the end, but pass this directly to curl_opts (bug introduced in 70a61a3)
  • curl_error($curl_handle) is not a safe error handling when RETURNTRANSFER is set to true (must check for $res === false, http://stackoverflow.com/questions/16452636/php-curl-what-does-curl-exec-return)
  • fetch the http status code and return an error
  • add Util class with http status code translation to string
  • better explanation of accesscode in the docs

fixes #31
fixes #32

- use curl_set_opts
- do not initialize $this->auth with an `@` at the end, but pass this directly to curl_opts (bug introduced in 70a61a3)
- curl_error($curl_handle) is not a safe error handling when RETURNTRANSFER is set to true (must check for $res === false, http://stackoverflow.com/questions/16452636/php-curl-what-does-curl-exec-return)
- fetch the http status code and return an error
- add Util class with http status code translation to string
- better explanation of `accesscode` in the docs

fixes #31
fixes #32
@dnsmichi
Copy link
Collaborator Author

PS: If you merge this to master (master is broken atm), I can merge Icinga/icinga-vagrant#59 :-)

@Mikesch-mp Mikesch-mp merged commit aee8154 into Mikesch-mp:master Apr 22, 2017
Mikesch-mp pushed a commit that referenced this pull request May 20, 2017
This also gives a hint for curl_error() == 7 which normally leads to SELinux.
Test that on a box with SELinux in enforcing mode.

Also fixed error handling of getPreviewImage (renamed to getPreviewHtml).
This commit passed the previewHtml variable by reference while returning true/false.
This allows to check whether to render the URL or not.

Simplified the code in some parts too.

refs #33
fixes #35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proxy mode error handling with curl is buggy and not verbose enough Proxy mode always returns 401
2 participants