rest_client behavior change in module version 2.2.3?

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

rest_client behavior change in module version 2.2.3?

Andreas Sikkema
Hi,

I am using the rest_client to retrieve some information about an
incoming call using the following:

if
(!rest_get("http://127.0.0.1:8888/dir/search?number_a=$fU&number_b=$rU",
"$var(name)", "$var(ct)", "$var(rcode)")) {
        xlog("Error code $var(rcode) in HTTP GET!\n");
}
else {
        xlog("Received $var(name) using REST for A number $fU and B number $rU\n");
        # magic
}

In rest_client module versions 2.2.2 (?) and before this worked like a
charm. When the web server returned a 404 or another error, the script
would log the error and go on. When rest_get() received a 200 OK, magic
would happen.

Since we upgraded to rest_client module version 2.2.3 this morning this
behavior changed. When the server returns a 404, rest_get doesn't error
out, but goes on as before, and my script now tries to do magic on a 404
message's HTML body. Which is not what I want...

Did I use the rest_get() return values incorrectly, or is it a bug?

--
Andreas Sikkema

_______________________________________________
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_client behavior change in module version 2.2.3?

Andreas Sikkema
Hi,

I did make the code a little more robust by not only checking if the
rest_get() call succeeded, but also checking if $var(rcode) equalled
"200" before doing the magic. This solved my problem.

--
Andreas Sikkema

_______________________________________________
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_client behavior change in module version 2.2.3?

Liviu Chircu
Hi Andreas,

Although we saw it as a bugfix (404 response is not a transfer error!),
I will add a mention regarding this patch in the migration page. Maybe
it will help avoid more issues similar to yours remaining undetected
after upgrading to 2.2.3.

Best regards,

Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com

OpenSIPS Summit May 2017 Amsterdam
   http://www.opensips.org/events/Summit-2017Amsterdam.html

On 07.03.2017 14:51, Andreas Sikkema wrote:
> Hi,
>
> I did make the code a little more robust by not only checking if the
> rest_get() call succeeded, but also checking if $var(rcode) equalled
> "200" before doing the magic. This solved my problem.
>


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