[Home]

Summary:ASTERISK-28613: func_curl: CURLOPT cannot set Content-Type header
Reporter:Martin Tomec (matesstar)Labels:
Date Opened:2019-11-07 08:51:25.000-0600Date Closed:2020-04-20 08:39:43
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Functions/func_curl
Versions:13.29.1 Frequency of
Occurrence
Related
Issues:
is related toASTERISK-29085 func_curl: Segmentation fault when using CURL after setting httpheader CURLOPT
Environment:Attachments:
Description:For sending JSON requests, CURLOPT should be able to set Content-Type header. There is demand for it:
https://asteriskfaqs.org/2018/10/04/asterisk-users/curl-to-post-applicationjson.html
I have prepared patch for http headers parameter setting.
Comments:By: Asterisk Team (asteriskteam) 2019-11-07 08:51:25.944-0600

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

By: Friendly Automation (friendly-automation) 2019-11-20 09:52:58.831-0600

Change 13182 merged by Friendly Automation:
func_curl.c: Support custom http headers

[https://gerrit.asterisk.org/c/asterisk/+/13182|https://gerrit.asterisk.org/c/asterisk/+/13182]

By: Friendly Automation (friendly-automation) 2019-11-20 09:58:12.468-0600

Change 13166 merged by Friendly Automation:
func_curl.c: Support custom http headers

[https://gerrit.asterisk.org/c/asterisk/+/13166|https://gerrit.asterisk.org/c/asterisk/+/13166]

By: Friendly Automation (friendly-automation) 2019-11-20 10:00:26.593-0600

Change 13183 merged by Friendly Automation:
func_curl.c: Support custom http headers

[https://gerrit.asterisk.org/c/asterisk/+/13183|https://gerrit.asterisk.org/c/asterisk/+/13183]

By: Friendly Automation (friendly-automation) 2019-11-20 16:20:51.189-0600

Change 13168 merged by Kevin Harwell:
func_curl.c: Support custom http headers

[https://gerrit.asterisk.org/c/asterisk/+/13168|https://gerrit.asterisk.org/c/asterisk/+/13168]

By: Thomas Guebels (tguescaux) 2019-11-21 08:26:38.788-0600

@matesstar

Hi Martin,

Looking at the patch it appears you can only add headers, not edit or remove them. This means that if you set the Content-Type for a first HTTP request, every following request on the same channel will have to use the same Content-Type. If you set it again you will end up with duplicate Content-Type headers on the next request. Isn't that a serious limitation ?

Actually, we tried to implement it the same way as you but hit that limitation which made it impractical for us. We are now working on an implementation where you can pass a dialplan hash containing multiple "header: value" to set at once, replacing the previous headers.



By: Martin Tomec (matesstar) 2020-04-20 08:38:39.604-0500

Hi Thomas,
I think that the curl object is created new for each request from IVR so this solution was "enougth good" for our usecase. Of course it can have some limitations and any new patches are welcome.

By: Asterisk Team (asteriskteam) 2020-04-20 08:38:40.106-0500

This issue has been reopened as a result of your commenting on it as the reporter. It will be triaged once again as applicable.