Re: Connection refused - subdomain problem suspected

2019-09-04 Thread René Berber via curl-library
On 9/4/2019 5:45 PM, Richard G Elen via curl-library wrote:
[snip]

Easy way out: add CURLOPT_VERBOSE to the options and see if the log
gives any good hint.

> TEST CODE
> 
>  header("Content-type: application/json; charset=utf-8");
>  
>         $url =
> "https://streams.ourstation.org:2199/rpc/ourstation/streaminfo.get;;
>        
>        
>         $mysession = curl_init();
>     curl_setopt($mysession, CURLOPT_URL, $url);
>     curl_setopt($mysession, CURLOPT_RETURNTRANSFER, 1);
>     curl_setopt($mysession, CURLOPT_CONNECTTIMEOUT , 10);
>     curl_setopt($mysession, CURLOPT_FAILONERROR, true);

Don't know/use php but... all options to curl are long integers, does
the above really work (i.e. 1 instead of 1L)?

>           $json = json_decode(curl_exec($mysession), true);
>          
>          
>         if (curl_errno($mysession)) {
>         echo "error: " . curl_error($mysession);
>         }else{
>         echo json_encode($json,JSON_PRETTY_PRINT);
>         }   
>         
> ?>

Guess time:

Could be many things, SSL options (CURLOPT_CAINFO), SSL library used
with php (OpenSSL and gnutls usually work, others may not).
-- 
R.Berber
---
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Connection refused - subdomain problem suspected

2019-09-04 Thread Richard G Elen via curl-library

Hello...

We're working with our developer to create a music royalty tracking 
system for our internet radio station.


We use curl from PHP to pull in "now playing" metadata from our 
streaming server's "streaminfo" URL.


During development, our developer used his own server to build the 
system and all was well.


Now he has moved it over to a server we have commissioned from our 
hosting company specifically for the purpose, this call no longer works, 
and neither we (nor our hosting provider) can work out why. We would 
appreciate some suggestions.


Our new database server has the hostname admin.ourstation.org ; our 
streaming server we can call streams.ourstation.org (domain anonymized).


We're trying to pull in the data from 
https://streams.ourstation.org:2199/rpc/ourstation/streaminfo.get. It 
constantly returns "Failed to connect to streams.ourstation.org port 
2199: Connection refused" - but only when accessed from our 
admin.ourstation.org host. All other machines we can test from return 
the data flawlessly.


We cannot access the command line on the new server ourselves, but our 
hosting provider tells us that if they run it as a curl command it works 
fine. I get a good result if I run a curl command from my desktop 
machine also. Our developer has done the following:


1. Run a test call (similar to below) /from /admin.ourstation.org /to 
/several other hosts and all work correctly
2. Run the test call below /from /several other hosts /to /return data 
from streams.ourstation.org and all work correctly
3. Our developer and I can both return data from streams.ourstation.org 
with manual curl calls from our desktop machines' command line.
4. Our developer has been able to recover data from 
streams.ourstation.org from the prototype system on his own server from 
the beginning (and still can).


ONLY the test from admin.ourstation.org to streams.ourstation.org fails.

We are therefore suspecting that there is a problem trying to return 
data from a related subdomain and we wonder how to solve this issue. The 
two servers are in different countries and the domain is managed by a 
third party; the servers both have A Records pointed at them and resolve 
suitably in a web browser, etc. The streams server has been running 
happily for a couple of years with no known DNS issues.


We would be most grateful for any observations. Thanks in advance!

--Richard E

TEST CODE

        $url = 
"https://streams.ourstation.org:2199/rpc/ourstation/streaminfo.get;;



        $mysession = curl_init();
    curl_setopt($mysession, CURLOPT_URL, $url);
    curl_setopt($mysession, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($mysession, CURLOPT_CONNECTTIMEOUT , 10);
    curl_setopt($mysession, CURLOPT_FAILONERROR, true);
          $json = json_decode(curl_exec($mysession), true);


        if (curl_errno($mysession)) {
        echo "error: " . curl_error($mysession);
        }else{
        echo json_encode($json,JSON_PRETTY_PRINT);
        }

?>

---
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Update on ESNI initiative

2019-09-04 Thread Niall O'Reilly via curl-library

Hi.

On 31 May 2019, at 9:52, Niall O'Reilly wrote:


More will follow in due course.


So far, we have the network side, between **curl** client
and an ESNI-aware server, working. Instructions for trying
this out are here: 
[https://github.com/niallor/curl/blob/master/ESNI-README.md](https://github.com/niallor/curl/blob/master/ESNI-README.md).


In the **curl** app, we’re cheating by providing parameters
for ESNI as command-line options instead of fetching what’s
published in the DNS. We’ll be working on that next.

Niall O’Reilly
---
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Re: curl crashes when internet switched off

2019-09-04 Thread Salman Ahmed via curl-library
Makes sense.
Thanks for the help + Rainer too

On Wed, Sep 4, 2019 at 3:45 PM Daniel Stenberg  wrote:

> On Wed, 4 Sep 2019, Salman Ahmed wrote:
>
> Please stop top-posting. It makes it really hard to follow this
> discussion/thread.
>
> > I updated my libcurl to 7.65.3 and at the same time I found out that the
> 3rd
> > party sdk i am using does use curl_easy_setopt(curl, CURLOPT_NOSIGNAL,
> 1).
> > After I set that to "0" my program didn't terminate when wifi was
> switched
> > off.
>
> Then you could probably achieve the same result with the older version as
> well.
>
> > But from the brief reading on google,
>
> Don't read on google. Read the genuine docs on the curl site.
>
> > it seems that CURLOPT_NOSIGNAL should be set to 1 for multithreaded
> > applications like mine. Is there a way to keep CURLOPT_NOSIGNAL = 1 and
> > handle the broken SIGPIPE problem I am getting originally?
>
> It depends on what you want to do.
>
> The SIGPIPE signal here originates from OpenSSL (when it tries to use the
> socket after the connection has closed). The only way to prevent that from
> happening in libcurl is for libcurl to switch off the signal on entry and
> switch it on again on exit. It does this if CURLOPT_NOSIGNAL is set to 1.
>
> The sighandler is however global for your application so if you use
> libcurl
> from multiple threads within that application libcurl will switch that
> state
> on/off in a racy manner and you don't really know how it'll handle the
> signal
> if/when it arrives.
>
> You're then better off adding a single global SIGPIPE ignore yourself and
> tell
> curl to hands off anything that has to do with signals.
>
> --
>
>   / daniel.haxx.se | Get the best commercial curl support there is - from
> me
>| Private help, bug fixes, support, ports, new features
>| https://www.wolfssl.com/contact/
>
---
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Re: curl crashes when internet switched off

2019-09-04 Thread Daniel Stenberg via curl-library

On Wed, 4 Sep 2019, Salman Ahmed wrote:

Please stop top-posting. It makes it really hard to follow this 
discussion/thread.


I updated my libcurl to 7.65.3 and at the same time I found out that the 3rd 
party sdk i am using does use curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1). 
After I set that to "0" my program didn't terminate when wifi was switched 
off.


Then you could probably achieve the same result with the older version as 
well.



But from the brief reading on google,


Don't read on google. Read the genuine docs on the curl site.

it seems that CURLOPT_NOSIGNAL should be set to 1 for multithreaded 
applications like mine. Is there a way to keep CURLOPT_NOSIGNAL = 1 and 
handle the broken SIGPIPE problem I am getting originally?


It depends on what you want to do.

The SIGPIPE signal here originates from OpenSSL (when it tries to use the 
socket after the connection has closed). The only way to prevent that from 
happening in libcurl is for libcurl to switch off the signal on entry and 
switch it on again on exit. It does this if CURLOPT_NOSIGNAL is set to 1.


The sighandler is however global for your application so if you use libcurl 
from multiple threads within that application libcurl will switch that state 
on/off in a racy manner and you don't really know how it'll handle the signal 
if/when it arrives.


You're then better off adding a single global SIGPIPE ignore yourself and tell 
curl to hands off anything that has to do with signals.


--

 / daniel.haxx.se | Get the best commercial curl support there is - from me
  | Private help, bug fixes, support, ports, new features
  | https://www.wolfssl.com/contact/
---
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Re: curl crashes when internet switched off

2019-09-04 Thread Salman Ahmed via curl-library
I updated my libcurl to 7.65.3 and at the same time I found out that the
3rd party sdk i am using does use curl_easy_setopt(curl, CURLOPT_NOSIGNAL,
1). After I set that to "0" my program didn't terminate when wifi was
switched off. But from the brief reading on google , it seems that
CURLOPT_NOSIGNAL should be set to 1 for multithreaded applications like
mine. Is there a way to keep CURLOPT_NOSIGNAL = 1 and handle the broken
SIGPIPE problem I am getting originally?

On Wed, Sep 4, 2019 at 2:43 PM Daniel Stenberg  wrote:

> On Wed, 4 Sep 2019, Salman Ahmed wrote:
>
> > CURL VER libcurl/7.47.0 OpenSSL/1.0.2g zlib/1.2.8 libidn/1.32 librtmp/2.3
> > Linux VirtualBox 4.15.0-58-generic #64~16.04.1-Ubuntu SMP Wed Aug 7
> > 14:10:35 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
> >
> > I guess its 3 year old libcurl?I dont remember manually
> configure/install.
> > I just got it from the ubuntu repos.
> > Do I need to build curl myself and have this symbol defined?
>
> Ah sorry I see now that I misread what TLS backend that was in use. Ignore
> my
> previous question.
>
> I guess you either suffer from an old libcurl bug (I searched but I
> couldn't
> find any obvious issue) or you've switched off signal handling with
> CURLOPT_NOSIGNAL.
>
> Maybe you can build a modern version as a test just to see if the problem
> persists then or not?
>
> (During those 3.5 years since we released 7.47.0, we have landed at least
> 2235
> documented bug fixes.)
>
> --
>
>   / daniel.haxx.se | Get the best commercial curl support there is - from
> me
>| Private help, bug fixes, support, ports, new features
>| https://www.wolfssl.com/contact/
>
---
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Re: curl crashes when internet switched off

2019-09-04 Thread Rainer Canavan via curl-library
On Wed, Sep 4, 2019 at 2:34 PM Salman Ahmed via curl-library
 wrote:
>
> CURL VER libcurl/7.47.0 OpenSSL/1.0.2g zlib/1.2.8 libidn/1.32 librtmp/2.3
> Linux VirtualBox 4.15.0-58-generic #64~16.04.1-Ubuntu SMP Wed Aug 7 14:10:35 
> UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
>
> I guess its 3 year old libcurl?I dont remember manually configure/install. I 
> just got it from the ubuntu repos.
> Do I need to build curl myself and have this symbol defined?

since you're probably using ubuntu packages for curl, the buildlog
here 
https://launchpadlibrarian.net/408958147/buildlog_ubuntu-xenial-amd64.curl_7.47.0-1ubuntu2.12_BUILDING.txt.gz
should be close enough to what you're using. If it's something
different, you can pick the relevant version from
https://launchpad.net/ubuntu/+source/curl/+publishinghistory, then the
architecture and finally the buildlog.  That build has

checking for MSG_NOSIGNAL... yes

rainer
---
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Re: curl crashes when internet switched off

2019-09-04 Thread Daniel Stenberg via curl-library

On Wed, 4 Sep 2019, Salman Ahmed wrote:


CURL VER libcurl/7.47.0 OpenSSL/1.0.2g zlib/1.2.8 libidn/1.32 librtmp/2.3
Linux VirtualBox 4.15.0-58-generic #64~16.04.1-Ubuntu SMP Wed Aug 7
14:10:35 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

I guess its 3 year old libcurl?I dont remember manually configure/install.
I just got it from the ubuntu repos.
Do I need to build curl myself and have this symbol defined?


Ah sorry I see now that I misread what TLS backend that was in use. Ignore my 
previous question.


I guess you either suffer from an old libcurl bug (I searched but I couldn't 
find any obvious issue) or you've switched off signal handling with 
CURLOPT_NOSIGNAL.


Maybe you can build a modern version as a test just to see if the problem 
persists then or not?


(During those 3.5 years since we released 7.47.0, we have landed at least 2235 
documented bug fixes.)


--

 / daniel.haxx.se | Get the best commercial curl support there is - from me
  | Private help, bug fixes, support, ports, new features
  | https://www.wolfssl.com/contact/
---
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Re: curl crashes when internet switched off

2019-09-04 Thread Salman Ahmed via curl-library
CURL VER libcurl/7.47.0 OpenSSL/1.0.2g zlib/1.2.8 libidn/1.32 librtmp/2.3
Linux VirtualBox 4.15.0-58-generic #64~16.04.1-Ubuntu SMP Wed Aug 7
14:10:35 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

I guess its 3 year old libcurl?I dont remember manually configure/install.
I just got it from the ubuntu repos.
Do I need to build curl myself and have this symbol defined?

Sorry forgot to Reply-All

On Wed, Sep 4, 2019 at 4:50 PM Daniel Stenberg  wrote:

> On Wed, 4 Sep 2019, Salman Ahmed via curl-library wrote:
>
> > I am facing this problem where my application just terminates when I
> > manually switch off my WiFi while it is waiting on curl_easy_perform()
> in a
> > separate thread from the main thread.
>
> What libcurl version is this? On Linux, right?
>
> > Thread 4 "my-app" received signal SIGPIPE, Broken pipe.
>
> libcurl should invoke send() with MSG_NOSIGNAL set that then would avoid
> this.
>
> Did configure find and define HAVE_MSG_NOSIGNAL for you?
>
> --
>
>   / daniel.haxx.se | Get the best commercial curl support there is - from
> me
>| Private help, bug fixes, support, ports, new features
>| https://www.wolfssl.com/contact/
>
---
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Re: curl crashes when internet switched off

2019-09-04 Thread Daniel Stenberg via curl-library

On Wed, 4 Sep 2019, Salman Ahmed via curl-library wrote:

I am facing this problem where my application just terminates when I 
manually switch off my WiFi while it is waiting on curl_easy_perform() in a 
separate thread from the main thread.


What libcurl version is this? On Linux, right?


Thread 4 "my-app" received signal SIGPIPE, Broken pipe.


libcurl should invoke send() with MSG_NOSIGNAL set that then would avoid this.

Did configure find and define HAVE_MSG_NOSIGNAL for you?

--

 / daniel.haxx.se | Get the best commercial curl support there is - from me
  | Private help, bug fixes, support, ports, new features
  | https://www.wolfssl.com/contact/
---
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

curl crashes when internet switched off

2019-09-04 Thread Salman Ahmed via curl-library
Hello,

I am facing this problem where my application just terminates when I
manually switch off my WiFi while it is waiting on curl_easy_perform() in a
separate thread from the main thread.

Thread 4 "my-app" received signal SIGPIPE, Broken pipe.
[Switching to Thread 0x7fffebfff700 (LWP 27283)]
0x775364bd in write () at ../sysdeps/unix/syscall-template.S:84
84 ../sysdeps/unix/syscall-template.S: No such file or directory.
(gdb) backtrace
#0  0x775364bd in write () at ../sysdeps/unix/syscall-template.S:84
#1  0x76772455 in ?? () from
/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
#2  0x7677047c in BIO_write () from
/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
#3  0x76ac9bf2 in ?? () from /lib/x86_64-linux-gnu/libssl.so.1.0.0
#4  0x76acbe13 in ?? () from /lib/x86_64-linux-gnu/libssl.so.1.0.0
#5  0x76ac7a22 in ?? () from /lib/x86_64-linux-gnu/libssl.so.1.0.0
#6  0x77bbb6e3 in ?? () from /usr/lib/x86_64-linux-gnu/libcurl.so.4
#7  0x77b89717 in ?? () from /usr/lib/x86_64-linux-gnu/libcurl.so.4
#8  0x77b8a12a in ?? () from /usr/lib/x86_64-linux-gnu/libcurl.so.4
#9  0x77b9e99f in ?? () from /usr/lib/x86_64-linux-gnu/libcurl.so.4
#10 0x77b9ef5d in curl_multi_perform () from
/usr/lib/x86_64-linux-gnu/libcurl.so.4
#11 0x77b95a0b in curl_easy_perform () from
/usr/lib/x86_64-linux-gnu/libcurl.so.4
#12 0x00405942 in my_curl_loop ()
#13 0x7752d6ba in start_thread (arg=0x7fffebfff700) at
pthread_create.c:333
#14 0x7726341d in clone () at
../sysdeps/unix/sysv/linux/x86_64/clone.S:109

I see that in my_curl_loop() , I am successfully able to call
curl_easy_perform() and block there. But as soon as I switch off my
internet , my app terminates without even returning from curl_easy_perform.

Any one got any ideas?
---
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html