Skip to content

Implement search timeout parameter #115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Oct 22, 2014
Merged

Implement search timeout parameter #115

merged 18 commits into from
Oct 22, 2014

Conversation

jch
Copy link
Member

@jch jch commented Oct 6, 2014

This is a proposal to implement timeouts for search requests (RFC 4511 4.5.1.5). I decided to name the parameter time to be consistent with the existing size parameter. I still need to figure out a good approach for testing this, but wanted to open this PR for comments.

Fixes #10. Note that this is the protocol timeout, and not a hard socket timeout. That can come in a separate PR.

@mtodd
Copy link
Member

mtodd commented Oct 6, 2014

Wiring looks good.

Testing is tricky since we want to avoid performing an actual query but faking it doesn't exactly test it honestly. Will give it some thought.

@jch
Copy link
Member Author

jch commented Oct 6, 2014

Going to sleep on it, but I think I want to test that the timeout integer is written out to the packet. Since it's just a timeout parameter, there's really no timeout to actually test since it's up to the server to respect the value.

Longer term, I think it'd be interesting to extract out a Net::LDAP::SearchRequest object for finer grained testing, but that's a bigger refactoring.

@mtodd
Copy link
Member

mtodd commented Oct 12, 2014

👍 agree on both observations.

Jerry Cheung added 8 commits October 17, 2014 10:02
@mtodd is this a stupid test? The logic in Connection#search handles both
writing the request and reading the response, making it really difficult to stub
out.
matches up with how `time` param works. @mtodd you okay with this?
def test_search_timeout
events = @service.subscribe "search.net_ldap_connection"

@ldap.search(:time => 5)
Copy link
Member

Choose a reason for hiding this comment

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

This will likely fail without a base specified.

@mtodd
Copy link
Member

mtodd commented Oct 21, 2014

@jch we'll also want to handle the timeLimitExceeded result as a "success" here:

when ResultStrings.key("Size Limit Exceeded")

Jerry Cheung added 2 commits October 21, 2014 14:38
@mtodd mtodd mentioned this pull request Oct 22, 2014
jch added a commit that referenced this pull request Oct 22, 2014
Implement search timeout parameter
@jch jch merged commit f40c46e into ruby-ldap:master Oct 22, 2014
@jch jch deleted the search-timeout branch October 22, 2014 03:23
astratto pushed a commit to astratto/ruby-net-ldap that referenced this pull request Dec 18, 2015
Implement search timeout parameter
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.

Timeout handler
2 participants