Hi, Here is a modification of the http_request function of the utils module. The idea is to ignore empty lines at the beginning of the http response. This way, the response returned to Kamailio is the first non empty line of the http response. This is to solve an issue encountered with apache2 sometimes returning empty lines. I am no c++ developper and no acquainted to Github (double check the patch). Thanks, Laurent. You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/321
-- Commit Summary --
* Update functions.c * Update: functions.c
-- File Changes --
M modules/utils/functions.c (19)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/321.patch https://github.com/kamailio/kamailio/pull/321.diff
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/321
Closed #321.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/321#event-412932995
I pushed a commit with a different implementation, controlled by a module parameter http_response_trim -- you have to set it to 1 to eneable the feature.
It removes all the white spaces from the beginning and end of the response, because I added another feature that allows to return the full http response instead of only first line.
Testing and feedback will be appreciated, for now I close this item.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/321#issuecomment-141366239
This is great, many thanks! I will test in the course of the day. BRs, Laurent.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/321#issuecomment-141367634
Hi, I have the following issue when making. Do I miss something?
Thanks, Laurent -------
CC (gcc) [M utils.so] utils.o utils.c: In function ‘w_http_query’: utils.c:469:2: error: too many arguments to function ‘http_query’ return http_query(_m, _url, _result, NULL, NULL); ^ In file included from utils.c:50:0: functions.h:43:5: note: declared here int http_query(struct sip_msg* _m, char* _url, char* _dst, char* _post); ^ utils.c: In function ‘w_http_query_post’: utils.c:476:2: error: too many arguments to function ‘http_query’ return http_query(_m, _url, _result, _post, NULL); ^ In file included from utils.c:50:0: functions.h:43:5: note: declared here int http_query(struct sip_msg* _m, char* _url, char* _dst, char* _post); ^ utils.c: In function ‘w_http_query_post_hdr’: utils.c:483:2: error: too many arguments to function ‘http_query’ return http_query(_m, _url, _result, _post, _hdr); ^ In file included from utils.c:50:0: functions.h:43:5: note: declared here int http_query(struct sip_msg* _m, char* _url, char* _dst, char* _post); ^ make[1]: *** [utils.o] Error 1 make: *** [install-modules] Error 1
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/321#issuecomment-141422146
Is it the git master branch?
If you cherry-picked in an older branch, then you may need to pick older commits to utils in master branch. You can eventually try by copying full utils module from master to older branch, but it might not work either. Test with pure master branch first.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/321#issuecomment-141423034