httpd: fix the misspelled access handler callback typedef - #4247
Open
denys-i-didww wants to merge 1 commit into
Open
httpd: fix the misspelled access handler callback typedef#4247denys-i-didww wants to merge 1 commit into
denys-i-didww wants to merge 1 commit into
Conversation
httpd_acces_handler_cb has been missing an "s" since the module was added in 9e86d39 (2012). Rename it to httpd_access_handler_cb, and fix the same word in the error message next to the check that uses it. The typedef is compile-time only and no module outside httpd names it - the five consumers pass their callbacks through httpd_api.register_httpdcb - so the rename changes no exported symbol and no ABI. No compatibility define is kept, following 36a09ee, which renamed the C variable outright and kept the old spelling only for the script-facing modparam. While here, two long-standing defects in the same declaration: - httpd_load.h declared "int register_httpdcb(...)", a function that has never existed: the implementation has been httpd_register_httpdcb since 2012, reached through the api struct. Nothing could link against the declaration, so it is removed rather than corrected. - the Developer Guide documented that dead five-parameter prototype. 0263804 (2013) added "enum HTTPD_CONTENT_TYPE type" to the register_httpdcb_f pointer that modules actually call, without updating either the prototype or the page. The parameter is now documented in its real position, between f2 and f3.
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.
Summary
The
httpdmodule declares its access handler callback ashttpd_acces_handler_cb,missing an
s. It is the last misspelled identifier left in the tree, and since 5 Augustit is also a contradiction: the README spells the callback correctly and the header does
not, so the published Developer Guide names a type that does not compile.
Correcting it opened two older defects in the same three lines of the same page. All three
are fixed here.
httpd_acces_handler_cbis misspelled in the header and the implementation9e86d39d9, 2012httpd_load.hdeclaresregister_httpdcb(), a function that has never existed9e86d39d9, 201202638044d, 2013Details
1. The typedef. Five occurrences:
httpd_load.h:68(the typedef),:115(thestruct httpd_cbmember),:130and:134(two declarations), andhttpd.c:240(theimplementation's signature). A sixth is the error message beside the check that uses it,
httpd.c:255—"NULL acces handler cb".For fourteen years the documentation matched the code.
e941906dd9(docs: fix README.mdtypos, 5 Aug 2026) corrected the page, which is right about English and leaves the two
sides disagreeing:
docs.opensips.org/manual/devel/modules/httpd/and/manual/4-1/publish
httpd_access_handler_cbtoday, and a module written from that page does notbuild. This PR closes the gap from the other side rather than reverting that commit.
It is the last one of its kind. Sweeping
.cand.hfor the usual misspellings —lenght,recieve,seperat,occured,sucess,paramater,treshold,adress,priviledge,notifiy,defualt— every surviving hit is in a comment or a log string.treshold,adressandparamaterwere removed from identifiers years ago;httpd_acces_handler_cbis the only one still in an identifier.2. A prototype with no function.
httpd_load.h:129-133declaredNo such function exists, and none ever has. The implementation is
httpd_register_httpdcb(
httpd.c:240), assigned to the api struct athttpd.c:302, and the five consumers reachit as
httpd_api.register_httpdcb(...).nm -Donhttpd.solistshttpd_register_httpdcband noregister_httpdcb, so nothing could ever have linkedagainst the declaration.
3. The documented signature is one parameter short.
02638044d(2013) addedenum HTTPD_CONTENT_TYPE typeto theregister_httpdcb_fpointer that modules actuallycall, and updated neither the prototype above nor the page. The Developer Guide section
was written in 2012 against the dead five-parameter prototype — it is unchanged since,
including through the move from
doc/httpd_devel.xmltoREADME.md. All five call sitesin the tree pass six arguments.
Solution
Rename the typedef to
httpd_access_handler_cband fix the same word in the errormessage. Remove the dead prototype rather than correct it: a corrected prototype would
still be a declaration with no definition. Document
typein its real position, betweenf2andf3; the callback's name on that page is already correct and is left alone.Reproduced
Debian 12,
opensips 4.1.0-devbuilt from this branch:httpd,mi_http,mi_html,mi_xmlrpc,pi_http,prometheus— compile with no warning and no error;nm -D --defined-only httpd.so, built frommasterand from this branch, is identical — 31 symbols. A typedef exists only atcompile time, so there is no ABI effect to weigh;
httpd+mi_http, MI over HTTP:That header is what the newly documented
typeparameter selects —mi_httpregisterswith
HTTPD_APPLICATION_JSON_CNT_TYPE.Where else this text appears
masteronly. On4.0and3.6the header and the README both sayacces, so thecontradiction this PR resolves does not exist there, and renaming a type mid-release
branch would be a change without a reason. Defects 2 and 3 are on those branches as well;
whether they are worth the same patch is the maintainers' call, not something I have
assumed.
Compatibility
Nothing breaks. The typedef is compile-time only, no module outside
httpdnames it, andmake installdoes not install module headers — no package exposes the old spelling toanything built out of tree. No compatibility
#defineis kept, following36a09ee7ab(dispatcher: Fix modparam typo), which renamed the C variable outright and kept the old
spelling only for the script-facing
modparam; there is no script-facing name here. Ifyou would rather have one, say so and I will add it.
This is a functional change, so CI runs on it — no
[skip ci].AI assistance disclosure. This change and its wording were produced with AI assistance.
Every item was checked against the source before submission:
httpd_load.h:68,:115,:130,:134,httpd.c:240and:255;history and
9e86d39d9(2012-01-25) already carries it;e941906dd9— at its parent commitREADME.md:374and:387readacces;docs.opensips.org/manual/devel/modules/httpd/and/manual/4-1/showaccess,/manual/4-0/still showsacces;*.cand*.hforeleven common misspellings, each hit classified as identifier or prose;
register_httpdcbhas never been defined —git log -Sover the full history returnsonly the 2012 commit that added the declaration, and
nm -Dconfirms it is notexported;
02638044d(2013); the original 2012doc/httpd_devel.xmldocuments the same five parameters as the page does now;output is quoted above;
36a09ee7ab.