Skip to content
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

Utils module: http_request modification #321

Closed
wants to merge 2 commits into from

Conversation

debackel
Copy link

@debackel debackel commented Sep 9, 2015

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.

Remove leading empty lines in http response, in order to return the first non-empty one.
utils: http_query now ignores leading empty lines

- http_query() ignore leading empty lines when parsing http response, to avoid returning an empty line.
@miconda
Copy link
Member

miconda commented Sep 18, 2015

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.

@miconda miconda closed this Sep 18, 2015
@debackel
Copy link
Author

This is great, many thanks!
I will test in the course of the day.
BRs,
Laurent.

@debackel
Copy link
Author

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

@miconda
Copy link
Member

miconda commented Sep 18, 2015

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.

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.

None yet

2 participants