!rest_get behavior

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

!rest_get behavior

Tito Cumpen

Group

I am using the latest opensips 2.3 and I am wondering why a 404 response doesn't invoke this block ?


                              if (!rest_get("http://$avp(api)/cc/authorized/$fU/$rU", "$json(authresponse)", "$var(ct)", "$var(rcode)")) {

         xlog("Error code $var(rcode) in HTTP GET!\n");


 xlog("on account of admittance error we are sending the call to the AS server for processing");

         route(ASroute);

 }



the far end response looks like this.


HTTP/1.1 404 Not Found.

X-Powered-By: Express.

Vary: Origin, Accept-Encoding.

Access-Control-Allow-Credentials: true.

Content-Type: text/plain; charset=utf-8.

Content-Length: 9.

ETag: W/"9-nR6tc+Z4+i9RpwqTOwvwFw".

Date: Tue, 25 Jul 2017 18:11:39 GMT.

Connection: keep-alive.

.

Not Found

from the example it looks like other 4XX responses are considered.


Thanks,
Tito



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: !rest_get behavior

Liviu Chircu

Hi Tito,

It seems that originally, the rest_xxx() functions could return either "false" or "true", depending if the used libcurl was patched or not. This commit [1] fixed the problem, but the doc examples were not updated. I'll have it fixed.

[1]: https://github.com/OpenSIPS/opensips/commit/1363a620

Best regards,

Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com
On 25.07.2017 21:18, Tito Cumpen wrote:

Group

I am using the latest opensips 2.3 and I am wondering why a 404 response doesn't invoke this block ?


                              if (!rest_get("http://$avp(api)/cc/authorized/$fU/$rU", "$json(authresponse)", "$var(ct)", "$var(rcode)")) {

         xlog("Error code $var(rcode) in HTTP GET!\n");


 xlog("on account of admittance error we are sending the call to the AS server for processing");

         route(ASroute);

 }



the far end response looks like this.


HTTP/1.1 404 Not Found.

X-Powered-By: Express.

Vary: Origin, Accept-Encoding.

Access-Control-Allow-Credentials: true.

Content-Type: text/plain; charset=utf-8.

Content-Length: 9.

ETag: W/"9-nR6tc+Z4+i9RpwqTOwvwFw".

Date: Tue, 25 Jul 2017 18:11:39 GMT.

Connection: keep-alive.

.

Not Found

from the example it looks like other 4XX responses are considered.


Thanks,
Tito




_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users


_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Loading...