Repository navigation
Name the 'not handled' ResponseNo sentinel HTTP_NOT_HANDLED - #568
Merged
Merged
Conversation
TdjHTTPConnector.OnCommand sets Response.ResponseNo to -1 before dispatching, and later handlers check for it to detect a request no earlier handler answered. The value is a Daraja convention, not an Indy one, but the bare literal made it look like an Indy magic number. Introduce HTTP_NOT_HANDLED in djHTTPConstants and use it in the connector, TdjDefaultHandler and TdjHandlerList (which tested the same sentinel as '> 0' / '< 0'). No behavior change. Based on the patch attached to #555, rebased onto the #564 connector change and extended to TdjHandlerList. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #555.
TdjHTTPConnector.OnCommandsetsResponse.ResponseNo := -1before dispatching, and later handlers check for that value to detect a request no earlier handler answered. The-1is a Daraja convention, not an Indy one, but the bare literal made it look like an Indy magic number.Changes
djHTTPConstants: new documented constantHTTP_NOT_HANDLED = -1.TdjHTTPConnector.OnCommand, which sets it, plus the comment in its exception handler.djHTTPConstantsgoes back into itsusesclause, after Reset the response before sending a 500 after an exception #566 had removed it.TdjDefaultHandler.Handle, which wasResponseNo = -1.TdjHandlerList.Handle, which wasResponseNo > 0/ResponseNo < 0. This one wasn't in the patch attached to the issue, though that patch's own doc comment namedTdjHandlerListas a user. It now compares with the constant. That would only behave differently ifResponseNowere 0 or another negative value, which nothing sets.ContentLength = -1("length unknown") is Indy's own convention, so it is left as it is.No behavior change.
Verification
Run locally before the rebase onto the merged #567, which touches none of these files:
run-fpc.cmd): 202 tests, 0 errors, 0 failures; heap trace at the clean baseline (6 blocks / 744 bytes).run-delphi.cmd): OK, 202 tests.🤖 Generated with Claude Code