[OpenSIPS-Devel] [opensips] Populate the rcode pval in rest get/post methods before returning error (#481)
    Jarrod Baumann 
    notifications at github.com
       
    Fri Apr 24 17:28:08 CEST 2015
    
    
  
Was able to duplicate an error posted to devel mailing list by philevans where if rest_get libcurl returned `CURLE_HTTP_RETURNED_ERROR` for any status >=400 it returned an error before populating the `code_pv` pvar even though the rest_client docs show it should be available [here](http://www.opensips.org/html/docs/modules/devel/rest_client.html#id293741) like this:
```
if (!rest_get("http://getcredit.org/?ruri=$fU", "$var(credit)", "$var(ct)", "$var(rcode)")) {
	xlog("Error code $var(rcode) in HTTP GET!\n");
	send_reply("403", "Not registered");
	exit;
}
```
This patch simply moves the code_rv population above the `(rc != CURLE_OK)` check.
You can view, comment on, or merge this pull request online at:
  https://github.com/OpenSIPS/opensips/pull/481
-- Commit Summary --
  * Populate the rcode pval in rest get/post methods before returning error
-- File Changes --
    M modules/rest_client/rest_methods.c (53)
-- Patch Links --
https://github.com/OpenSIPS/opensips/pull/481.patch
https://github.com/OpenSIPS/opensips/pull/481.diff
---
Reply to this email directly or view it on GitHub:
https://github.com/OpenSIPS/opensips/pull/481
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/devel/attachments/20150424/6b8ac97e/attachment.htm>
    
    
More information about the Devel
mailing list