Skip to content

Conversation

@z-sztrom
Copy link
Contributor

@z-sztrom z-sztrom commented Mar 27, 2024

Applicable Issues

Description of the Change

When LDAP request timeouts, publish service responds HTTP status 504 instead of 401.
401 status confused users as they expected incorrect password was submitted.

Alternate Designs

Possible Drawbacks

Sign-off

Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
have the right to submit it under the open source license
indicated in the file; or

(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or

(c) The contribution was provided directly to me by some other
person who certified (a), (b) or (c) and I have not modified
it.

(d) I understand and agree that this project and the contribution
are public and that a record of the contribution (including all
personal information I submit with it, including my sign-off) is
maintained indefinitely and may be redistributed consistent with
this project or the open source license(s) involved.

Signed-off-by: Roman Szturc roman.szturc.ext@ericsson.com

Copy link
Contributor

@vishnu-alapati vishnu-alapati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks fine and tested it in docker, i can see 504 status when the timeout happen with connect timed out message.

@z-sztrom z-sztrom changed the title Service responds HTTP status 506 in case of LDAP timeout Service responds HTTP status 504 in case of LDAP timeout Apr 10, 2024
@z-sztrom
Copy link
Contributor Author

Yes, 506 was just my mistype. 504 is correct. I've fixed that in the description here.

@piyush-sadangi
Copy link
Contributor

Yes, 506 was just my mistype. 504 is correct. I've fixed that in the description here.

Okay. So, we are using 504, and not ceating any custom HTTP status code?

cause = communicationException.getCause();
if (cause instanceof javax.naming.CommunicationException namingCommunicationException) {
String message = namingCommunicationException.toString();
LOGGER.warn("Communication problem: {}; {}", HttpStatus.GATEWAY_TIMEOUT, message);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is GATEWAY_TIMEOUT the most appropriate HTTP status code for all possible CommunicationException scenarios?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a bit confused. I did bit of googling and 504 status code is for gate-way timeout. But, the ticket says 506 status code. I assume we are trying to create a custom HTTP status code like 506 for LDAP timeout. If that is the case, why yse 504?

Correct me if i have not understood it right.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is GATEWAY_TIMEOUT the most appropriate HTTP status code for all possible CommunicationException scenarios?

You're right, strictly speaking LDAP isn't "a content delivery service" publisher depends on. But it cannot deliver response if LDAP is unavailable. That's why I used this status code.

Do you have a suggestion?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a bit confused. I did bit of googling and 504 status code is for gate-way timeout. But, the ticket says 506 status code. I assume we are trying to create a custom HTTP status code like 506 for LDAP timeout. If that is the case, why yse 504?

Correct me if i have not understood it right.

Yes, should be 504. Fixed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is GATEWAY_TIMEOUT the most appropriate HTTP status code for all possible CommunicationException scenarios?

You're right, strictly speaking LDAP isn't "a content delivery service" publisher depends on. But it cannot deliver response if LDAP is unavailable. That's why I used this status code.

Do you have a suggestion?

No, it makes sense. I am okay with the existing HTTP status code. Thank you for the response.

Copy link
Contributor

@piyush-sadangi piyush-sadangi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@z-sztrom z-sztrom self-assigned this Apr 10, 2024
@z-sztrom z-sztrom merged commit 0ec8e8b into eiffel-community:master Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants