Re: [naviserver-devel] Converting a CURL call to a ns_http call

2019-11-19 Thread iuri
Hi Gustaf,Does tip mean the latest?I thought the tip version of Naviserver was 4.99.18. At least that .18 is available on sourceforge to downloadhttps://sourceforge.net/projects/naviserver/Best wishes,I Original Message Subject: Re: [naviserver-devel] Converting a CURL call to

Re: [naviserver-devel] Converting a CURL call to a ns_http call

2019-11-19 Thread Gustaf Neumann
On 17.11.19 18:00, Iuri Sampaio wrote: Do you still get successful results ? https://iurix.com/paypal-get-token No sure, what you want me to test. The site above runs for me into a timeout. Running with the tip version leads now own https://api.sandbox.p

Re: [naviserver-devel] Converting a CURL call to a ns_http call

2019-11-17 Thread Iuri Sampaio
The end of SSL request seems fine, except for 2 evidences that caught my attention i. the long loop of ssl connect on sock 28; > [17/Nov/2019:13:49:55][634.7f6a4f62b700][-conn:iurix:0:44-] Debug: ssl > connect on sock 28 ii. the end of logging has an error [17/Nov/2019:13:49:55][634.7f6a

Re: [naviserver-devel] Converting a CURL call to a ns_http call

2019-11-17 Thread Iuri Sampaio
As indicated in the log, I’ve edited /etc/hosts, and assigned 173.0.82.78 to api.sandbox.paypal.com but nothing has changed. [17/Nov/2019:13:49:55][634.7f6a4f62b700][-conn:iurix:0:44-] Debug: 0x7f6a40060f10 REUSE sql [17/Nov/2019:13:49:55][634.7f6a4f62b700][-co

Re: [naviserver-devel] Converting a CURL call to a ns_http call

2019-11-17 Thread Iuri Sampaio
NS has been updated to .18 I’ve set logging as recommended. #ns_logctl severity "Debug(ns:driver)" $debug

Re: [naviserver-devel] Converting a CURL call to a ns_http call

2019-11-17 Thread Gustaf Neumann
On 17.11.19 17:04, Iuri Sampaio wrote: NaviServer/4.99.17 Should I upgrade it? yes. There are fixes for partly configured IPv6 setups in the 4.99.18 release (read the NEWS file). I would recommend to use the tip version (the same i have used). ... and set logging as recommended in my last m

Re: [naviserver-devel] Converting a CURL call to a ns_http call

2019-11-17 Thread Iuri Sampaio
Gustaf, Despite the immense frustration for having wasted hours debugging a script, which is properly written, I’m glad you got successful results. At least now we know the problem can be in the environment. I’ve changed servers to evaluate and mitigate environment problems. https://iurix.com

Re: [naviserver-devel] Converting a CURL call to a ns_http call

2019-11-17 Thread Gustaf Neumann
On 17.11.19 00:00, Iuri Sampaio wrote: I was expecting to get the same thing with ns_http. However, when I ran https://api.sandbox.paypal.com/v1/oauth2/token  status returns 0 and body returns  null.  It’;s available at ttps://evex.co/paypal-check

Re: [naviserver-devel] Converting a CURL call to a ns_http call

2019-11-16 Thread Iuri Sampaio
Btw, the very same request works fine not only on CURL but also on Postman. For instance, that’s the response CURL and Postman return { "scope": "https://uri.paypal.com/services/invoicing https://uri.paypal.com/services/disputes/read-buyer https://uri.paypal.com/services/payments/realtimepay

Re: [naviserver-devel] Converting a CURL call to a ns_http call

2019-11-16 Thread Iuri Sampaio
I’ve just ran the sample you suggested. Results returned successfully. (i) Meaning body returned content within. Meaning Authorization headers were properly converted to base64 and authentication worked just fine Also, in the CURL command, running it in the command line prompt, body returns a

Re: [naviserver-devel] Converting a CURL call to a ns_http call

2019-11-16 Thread Iuri Sampaio
Dear Gustaf, It did help me to remind and review my own code to assure that it was properly written. I grabbed the code from https://naviserver.sourceforge.io/n/naviserver/files/ns_http.html#5 Plus, I switched to ns_base40enc

Re: [naviserver-devel] Converting a CURL call to a ns_http call

2019-11-16 Thread Iuri Sampaio
Dear Gustaf, It did help me to remind and review my own code to assure that it was properly written. I grabbed the code from https://naviserver.sourceforge.io/n/naviserver/files/ns_http.html#5 Plus, I switched to ns_base40enc

Re: [naviserver-devel] Converting a CURL call to a ns_http call

2019-11-16 Thread Gustaf Neumann
Dear Iuri, Let's start with a simple example: make a GET request to a service, which requires basic authentication % ns_http run https://jigsaw.w3.org/HTTP/Basic/ status 401 time 0:513863 headers d11 body {http://www.w3.org/TR/html4/loose.dtd";> ... NaviServer returns (starting with 4.99.

Re: [naviserver-devel] Converting a CURL call to a ns_http call

2019-11-15 Thread Iuri Sampaio
The same request returns successfully in python, as in conn = http.client.HTTPConnection("api,sandbox,paypal,com") payload = "grant_type=client_credentials" headers = { 'Content-Type': "application/x-www-form-urlencoded", 'Authorization': "Basic QVF5YS10UmFKUlIzTVVHQVY2MTg4OVl5eEc1MFdm

Re: [naviserver-devel] Converting a CURL call to a ns_http call

2019-11-15 Thread Iuri Sampaio
So far, I added the line ns_set update $requestHeaders "Authorization" "Basic $auth_base64" which is using set auth_base64 [base64::encode “”] and the results are [15/Nov/2019:13:19:55][450.7f7a7d7fa700][task:tclhttp] Notice: HttpTaskRecv: connection probably closed by server (url h

[naviserver-devel] Converting a CURL call to a ns_http call

2019-11-15 Thread Iuri Sampaio
What would be the argument/switch to convert the option -u, from CURL command, to ns_http command? curl -v https://myhost.com/oauth2/token \ -H "Accept: application/json" \ -H "Accept-Language: en_US" \ -u "client_id:secret" \ -d "grant_type=client_cr