[Asterisk-code-review] Mofified funcs/func_curl.c so that we can set what constitutes a fai... (asterisk[16])

George Joseph asteriskteam at digium.com
Wed Oct 28 07:55:28 CDT 2020


George Joseph has posted comments on this change. ( https://gerrit.asterisk.org/c/asterisk/+/15066 )

Change subject: Mofified funcs/func_curl.c so that we can set what constitutes a  failure for curl requests for instance a 404 or 503. This is for ASTERISK-28825
......................................................................


Patch Set 2: Code-Review-1

(7 comments)

I agree with Josh.  If you use strsep to parse the list of codes and store them in an ast_vector_int you can easily handle multiple codes.  There are lots of examples elsewhere in the Asterisk codebase.

https://gerrit.asterisk.org/c/asterisk/+/15066/2/configs/samples/res_curl.conf.sample 
File configs/samples/res_curl.conf.sample:

https://gerrit.asterisk.org/c/asterisk/+/15066/2/configs/samples/res_curl.conf.sample@9 
PS2, Line 9: ;failurecode
Should be plural "failurecodes"


https://gerrit.asterisk.org/c/asterisk/+/15066/2/funcs/func_curl.c 
File funcs/func_curl.c:

https://gerrit.asterisk.org/c/asterisk/+/15066/2/funcs/func_curl.c@190 
PS2, Line 190: failurecode
Should be plural "failurecodes"


https://gerrit.asterisk.org/c/asterisk/+/15066/2/funcs/func_curl.c@191 
PS2, Line 191: Interrupt based on specific http real curl error
"A comma separated list of HTTP response codes to be treated as errors"


https://gerrit.asterisk.org/c/asterisk/+/15066/2/funcs/func_curl.c@326 
PS2, Line 326: failurecode
failurecodes


https://gerrit.asterisk.org/c/asterisk/+/15066/2/funcs/func_curl.c@328 
PS2, Line 328: OT_INTEGER
OT_STRING


https://gerrit.asterisk.org/c/asterisk/+/15066/2/funcs/func_curl.c@668 
PS2, Line 668: long hasfailurecode=0
If you make this an ast_vector_int you can easily use strsep to parse the comma separated list of error codes and add them to the vector, then when you get a response it's only a few lines of code to test each element in the vector.


https://gerrit.asterisk.org/c/asterisk/+/15066/2/funcs/func_curl.c@905 
PS2, Line 905: "  failurecode    - Interrupt based on specific http error code(integer)\n"
This line should be below the following line.



-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/15066
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I94443e508343e0a3e535e51ea6e0562767639987
Gerrit-Change-Number: 15066
Gerrit-PatchSet: 2
Gerrit-Owner: Dovid Bender <dovid at telecurve.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Comment-Date: Wed, 28 Oct 2020 12:55:28 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20201028/d181d7a1/attachment-0001.html>


More information about the asterisk-code-review mailing list