"Companies Using curl .."

2021-03-02 Thread Gisle Vanem via curl-library

Something for:
  https://curl.se/docs/companies.html

'Ashampoo Technology GmbH Co. KG' is using libcurl
via 'ash_libcurl.dll'. Ref:
  https://www.pconlife.com/viewfileinfo/ash-libcurl-dll/

Found out since I just installed Ashampoo Backup and was quite
impressed with it.

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

Re: Feature-Request: sendfile(2)

2021-02-25 Thread Gisle Vanem via curl-library

Emil Engler wrote:


However implementing this syscall also raises some problems, including
limited support. AFAIK only Linux and FreeBSD support this syscall
(maybe even macOS as it inherited a lot from FreeBSD).


FYI, Windows has a similar 'TransmitFile()' function:
  
https://docs.microsoft.com/en-us/windows/win32/api/mswsock/nf-mswsock-transmitfile

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

Re: libcurl hang

2020-10-21 Thread Gisle Vanem via curl-library

MS wrote:


1)
Using libcurl without a proxy, the verbose options shows "Trying ip address" 
and nothing else.
If restricted to IPv4 it shows only one line. If IPv6 is permitted, I get a 
first response that network
is not reachable and then a second response "Trying ..." which hangs.


Some issue with your ISP and IPv6. A 6to4 solution or
a native-IPv6? What if you do 'tracert.exe -6 2a04:4e42:200::81'

I'm on Win-10 and it shows 8 hop to Holland. When I had a
6to4 solution from Telenor, most of my IPv6 traffic went
via Los Angeles!


 >curl -v bbc.co.uk
*   Trying 2a04:4e42:600::81:80...
* connect to 2a04:4e42:600::81 port 80 failed: Network unreachable
*   Trying 2a04:4e42::81:80...
* connect to 2a04:4e42::81 port 80 failed: Network unreachable
*   Trying 2a04:4e42:400::81:80...
* connect to 2a04:4e42:400::81 port 80 failed: Network unreachable
*   Trying 2a04:4e42:200::81:80...
* connect to 2a04:4e42:200::81 port 80 failed: Network unreachable
*   Trying 151.101.64.81:80...
* Connected to bbc.co.uk (151.101.64.81) port 80 (#0)


All these addresses are part of FASTLY's net.
Check at https://status.fastly.com.

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

Re: static libcurl with clang

2020-03-22 Thread Gisle Vanem via curl-library

Ray Satiro wrote:

most of that but you may have to specify some on your own such as ws2_32. If the functions it can't find are CRT 
functions then that is an issue with your project and not libcurl.


Maybe it's an idea to add something like:

 #if defined(_MSC_VER) && defined(CURL_STATICLIB) && \
!defined(CURL_NO_DEFAULT_LINKED_LIBS)
   #pragma comment(lib, "libcurl_a.lib")
 #endif

somewhere? With checks for '_DEBUG' etc.

--
--gv

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

Re: Missing bcrytp.dll when running Watcom compiled Libcurl program on XP.

2019-07-03 Thread Gisle Vanem via curl-library

Dan Gribble wrote:

I have copied libcrypto-1_1.dll and libssl-1_1.dll (from openssl 1.1.1c) 
to my application directory in order to run the compiled application,

but other than that I have not done anything else.


You have to rebuild OpenSSL with a '_WIN32_WINNT' value
suitable for Win-XP ('-D_WIN32_WINNT=0x0501' should work
I think). Or maybe lower the value in 'Configurations\50-win-onecore.conf'

Look at OpenSSL's crypto/rand/rand_win.c where bcrypt.dll
functions are used:

  /* On Windows Vista or higher use BCrypt instead of the legacy CryptoAPI */
  # if defined(_MSC_VER) && defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0600
  #  define USE_BCRYPTGENRANDOM
  # endif


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

Re: curl turns 21 years today

2019-03-20 Thread Gisle Vanem via curl-library

Daniel Stenberg wrote:


Today it is exactly 21 years since the first curl version was released!

  https://daniel.haxx.se/blog/2019/03/20/happy-21st-curl/


BTW.

Incidently, today is also 'Spring Equinox' which
was also true in 1998:
  https://greenwichmeantime.com/longest-day/equinox-solstice-1992-1999/

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

Re: docs: curl-related videos

2019-01-31 Thread Gisle Vanem via curl-library

Daniel Stenberg wrote:

If you know of other video presentations that would be 
suitable to add to this page, please let us know.


A more recent 2017 Gource Visualization of curl's
evolution on GitHub:
  https://www.youtube.com/watch?v=JBcwjycnZE0

There are others too. Search for "gource visualization libcurl"
on YouTube.

Probably not what you're looking for but pretty nice!
(set the video to 1/4 speed to get the details).

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

Re: Successfully build after 2 week struggle but...!

2019-01-25 Thread Gisle Vanem via curl-library

Himanshu Rastogi wrote:


My configuration:
*Included Library:* /libssl, libssh2, zlibwapi, libcrypo, nghttp2, Ws2_32, 
Wldap32, Normaliz, winmm./
/*CFLAGS : /*MT/
*Preprocessor macro: *CURL_STATICLIB
*Compiler: VC15*
*BUT!*
After all these configuration it still show error messages like:
*BUILD OUTPUT:*
K4049: locally defined symbol __open imported
libcurl.lib(mime.obj) : error LNK2019: unresolved external symbol __imp__access 
referenced in function _curl_mime_filedata


I suspect you have compiled files with both:
  cl -MT ...   (for your code)
and:
  cl -MD ...   (for libcurl code)

Try linking with 'link -verbose ...', redirect the output
and look for what CRT libraries pulls in.

crypto.lib(e_capi.obj) : error LNK2019: unresolved external symbol __imp__CertOpenStore@20 referenced in function 
_capi_open_store


You need to ensure 'link ... crypt32.lib' is used.


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

[Win32] Fix for compiling with lwIP

2018-10-22 Thread Gisle Vanem via curl-library

I tried creating a Pull-Request on Github.
But got a:
  Pull request creation failed. Validation failed: A pull request
  already exists for curl:lwip-patch.

So here it is the old way:

Compiling on Windows (`_WIN32`) with `USE_LWIPSOCK`, causes this error:
  curl_rtmp.c(223,3):  error: use of undeclared identifier 'setsockopt'
setsockopt(r->m_sb.sb_socket, SOL_SOCKET, SO_RCVTIMEO,
^
  curl_rtmp.c(41,32):  note: expanded from macro 'setsockopt'
  #define setsockopt(a,b,c,d,e) (setsockopt)(a,b,c,(const char *)d,(int)e)
 ^
(from with clang-cl).

Patch:

--- a/lib/curl_rtmp.c 2018-05-09 19:58:09
+++ b/lib/curl_rtmp.c 2018-10-22 08:27:15
@@ -37,7 +37,7 @@
 /* The last #include file should be: */
 #include "memdebug.h"

-#ifdef _WIN32
+#if defined(_WIN32) && !defined(USE_LWIPSOCK)
 #define setsockopt(a,b,c,d,e) (setsockopt)(a,b,c,(const char *)d,(int)e)
 #define SET_RCVTIMEO(tv,s)   int tv = s*1000
 #else

---

And BTW, the noise-level from clang-cl from memdebug.h is staggering.
E.g.
In file included from wildcard.c:31:
./memdebug.h(99,9):  warning: 'send' macro redefined [-Wmacro-redefined]
#define send(a,b,c,d) curl_dosend(a,b,c,d, __LINE__, __FILE__)
^
f:/MingW32/src/inet/lwip/src/include\lwip/sockets.h(640,9):  note: previous 
definition is here
#define send(s,dataptr,size,flags)
lwip_send(s,dataptr,size,flags)
^
In file included from wildcard.c:31:
./memdebug.h(100,9):  warning: 'recv' macro redefined [-Wmacro-redefined]
#define recv(a,b,c,d) curl_dorecv(a,b,c,d, __LINE__, __FILE__)
^
f:/MingW32/src/inet/lwip/src/include\lwip/sockets.h(634,9):  note: previous 
definition is here
#define recv(s,mem,len,flags) lwip_recv(s,mem,len,flags)
^


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

Re: Using A Different Socket For Requests

2018-08-22 Thread Gisle Vanem via curl-library

Isaiah Banks wrote:

I'm sure this question has been asked before, but in doing some online research I have not found a good answer. What I'd 
like to do is create a custom socket for all curl requests to go through within a web application.


I'm creating this socket within Python application but would like an app written in PHP to send request through it. I've 
tried creating it, binding it to a port, and then passing the port number to the cURL request using CURLOPT_LOCALPORT, 
but it didn't seem to work. Is this the only way to do it and still be able to monitor data packets? Or is there another 
recommended way?


W/o knowing any details or especially PHP, I assume you'll
need to call:
  setsockopt (sock, SOL_SOCKET, SO_REUSEADDR,..

before a bind() and before the socket can be shared like this.
Or use SO_EXCLUSIVEADDRUSE depending on you OS.

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

Re: Retrieve all addresses mapped to specific host, not just one IP

2018-08-14 Thread Gisle Vanem via curl-library

myLC--- wrote:


Prioritization (which IPs libcurl should favor) might become
an issue then. 


"should favour" how? Based on what; that IPv6 is better/speedier
than IPv4, or some addresses based on Geo-location is best?
libcurl knows zero about this. It would be cool if it did though.

In fact IPv6 can be a lot slower than IPv4. My case right now
(with IPv6 over a '6to4' tunnel) is that a:
  curl -6 server-in-Oslo-Norway
goes via California! (3 times slow that with 'curl -4').

So much this hyped-up IPv6 protocol.

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

Re: Retrieve all addresses mapped to specific host, not just one IP

2018-08-13 Thread Gisle Vanem via curl-library

myLC---wrote:


at the source. Unless I'm mistaken, you are using a renamed
addrinfo struct on the inside.
Could it lead to problems with multiple threads, if you
simply passed a pointer to that (chain of) struct(s) via
curl_easy_getinfo? 


It's copied to an internal structure inside 'singleipconnect()'
AFAICS.

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

Re: Retrieve all addresses mapped to specific host, not just one IP

2018-08-11 Thread Gisle Vanem via curl-library

myLC---wrote:


I would like to know how we can retrieve all the IP
addresses which are mapped to a host.

Assuming we have the URL
https://example.buzz/bingo_results/

and assuming further that there are 5 addresses mapped to
this hostname:
10.0.0.11, 10.0.0.12, 10.0.0.13,
fd0e:34f4:760f:5bd6:0123:4567:89ab:cdef,
fd0e:34f4:760f:5bd6::::

How would I get them from libcurl?


Not sure you can get them all (unless one of them
fail). But the "primary IP" could be fetched by:
  char ip [5*16]; // enough for IPv6?
  curl_easy_getinfo(curl, CURLINFO_PRIMARY_IP, ip);

Or try my old 'sock_snoop.c' example attached.

c:\>sock_snoop.exe -v http://www.vg.no

* STATE: INIT => CONNECT handle 0x24bb028; line 1447 (connection #-5000)
* Rebuilt URL to: www.vg.no/
* Added connection 0. The cache now contains 1 members
* STATE: CONNECT => WAITRESOLVE handle 0x24bb028; line 1483 (connection #0)
AF_INET: 195.88.54.16

*   Trying 195.88.54.16...
* Could not set TCP_NODELAY: Descriptor is not a socket
* Immediate connect fail for 195.88.54.16: Descriptor is not a socket
AF_INET: 195.88.55.16

*   Trying 195.88.55.16...
* Could not set TCP_NODELAY: Descriptor is not a socket
* Immediate connect fail for 195.88.55.16: Descriptor is not a socket
AF_INET6: 2001:67c:21e0::16

*   Trying 2001:67c:21e0::16...
* Could not set TCP_NODELAY: Descriptor is not a socket
* Immediate connect fail for 2001:67c:21e0::16: Descriptor is not a socket
* Closing connection 0
* The cache now contains 0 members
* Expire cleared



--
--gv


#include 
#include 
#include 

static int snoop = 1;

static SOCKET getsock (void *clientp,
   curlsocktype purpose,
   struct curl_sockaddr *ca)
{
  const struct sockaddr_in  *a4 = (const struct sockaddr_in*) >addr;
  const struct sockaddr_in6 *a6 = (const struct sockaddr_in6*) >addr;
  char  buf [200];

  switch (ca->family)
  {
   case AF_INET:
printf ("AF_INET:  %s\n", inet_ntop(ca->family, >sin_addr, buf, 
sizeof(buf)));
break;
   case AF_INET6:
printf ("AF_INET6: %s\n", inet_ntop(ca->family, >sin6_addr, buf, 
sizeof(buf)));
break;
  }
  if (snoop)
 return 0;
  return socket (ca->family, ca->protocol, 0);
}

int main (int argc, char **argv)
{
  CURL *curl = NULL;
  char  scheme [200+1];
  char  url [200+1];
  int   verbose = 0;

  if (argc > 1 && !strcmp(argv[1],"-v"))
  {
verbose = 1;
argc--;
argv++;
  }

  if (argc < 2 || sscanf(argv[1],"%20[^/:]://%s",scheme,url) != 2)
  {
printf ("Usage: sock_snoop [-v] \n");
return (-1);
  }

  curl = curl_easy_init();

  curl_easy_setopt (curl, CURLOPT_CONNECT_ONLY, 1);
  curl_easy_setopt (curl, CURLOPT_URL, url);
  curl_easy_setopt (curl, CURLOPT_OPENSOCKETFUNCTION, getsock);
  curl_easy_setopt (curl, CURLOPT_VERBOSE, verbose);
  curl_easy_perform (curl);
  curl_easy_cleanup (curl);
  return (0);
}
---
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Re: Windows users! Help us test upload performance tuning?

2018-08-09 Thread Gisle Vanem via curl-library

Jan Ehrhardt wrote:


Wow dude! 2 times faster than FileZilla now.

Time decreased from 33.153s to 6.4 sec (same random 10 MByte file).
Versus approx. 5.3 sec for curl/FTP.


Using SFTP?


Yes:
curl.exe -k -# --write-out "speed: %%{speed_upload} bytes/sec, total-time: 
%%{time_total}" ^
 sftp://xyz -T c:\TEMP\curl-test.file
speed: 1649348,000 bytes/sec, total-time: 6,063000


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

Re: Windows users! Help us test upload performance tuning?

2018-08-09 Thread Gisle Vanem via curl-library

Daniel Stenberg wrote:


  /* The upload buffer size, should not be smaller than CURL_MAX_WRITE_SIZE, as
     it needs to hold a full buffer as could be sent in a write callback */
-#define UPLOAD_BUFSIZE CURL_MAX_WRITE_SIZE
+#define UPLOAD_BUFSIZE (512*1024)


Wow dude! 2 times faster than FileZilla now.

Time decreased from 33.153s to 6.4 sec (same random 10 MByte file).
Versus approx. 5.3 sec for curl/FTP.

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

Re: Windows users! Help us test upload performance tuning?

2018-08-09 Thread Gisle Vanem via curl-library

Jan Ehrhardt wrote:


33.153s vs 5.4s for a 10 MByte file.


Did you time how long Filezilla takes for the same action? Filezilla
squeezes quite a lot over sftp-connections...


11.4 sec!!

From the "About" box:
  Version:  3.31.0
  Build information:
Compiled for:   x86_64-w64-mingw32
Compiled with:  x86_64-w64-mingw32-gcc (GCC) 6.3.0 20170516
Compiler flags: -g -O2 -Wall
GnuTLS: 3.5.18
CPU features:   sse sse2 sse3 ssse3 sse4.1 sse4.2 avx avx2 aes pclmulqdq 
rdrnd bmi2 bmi2

I must be using the wrong compiler and SSL-lib :-)
But, it's certainly possible to make SFTP faster.

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

Re: Windows users! Help us test upload performance tuning?

2018-08-08 Thread Gisle Vanem via curl-library

Jan Ehrhardt wrote:


I ended up with a Windows port of lftp, launched from a bash script. Curl sftp
did resume, but was terribly slow. 


I also just tested with 'curl sftp//:' with the latest libssh2
and the new 'SIO_IDEAL_SEND_BACKLOG_QUERY' option. 'sftp://' is
still 6 times slower than ftp against the same server in Denmark.

33.153s vs 5.4s for a 10 MByte file.

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

curl / libcurl CHM-file

2018-01-24 Thread Gisle Vanem via curl-library

I've created a GNU-makefile to generate a
single Compressed HTML file (curl.chm) from all
'curl/docs/*.1' and 'curl/libcurl/*.3' files.

It's here (curl-roffit-chm.make):
  https://gist.github.com/gvanem/a50fc9457593b571d5190bdbe30fe1a4

And it uses Daniel's 'roffit' Perl-script:
  https://github.com/bagder/roffit

which the makefile downloads in case it's not found;
using curl off-course.

In case you're not on Windows (no hh.exe), try this excellent
Qt-based CHM viewer:
 http://www.ulduzsoft.com/linux/kchmviewer/getting-kchmviewer/
 https://sourceforge.net/projects/kchmviewer/files/kchmviewer/7.7/

Work in progress; the Content-page looks awful and there's no index.
Improvements welcome.

--
--gv

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

AF_UNIX comes to Windows

2018-01-17 Thread Gisle Vanem via curl-library

According to this blog, AF_UNIX comes to Windows 10:
  
https://blogs.msdn.microsoft.com/commandline/2017/12/19/af_unix-comes-to-windows/

This feature has no connection to the "Windows Subsystem for Linux (WSL)".
(WSL already has AF_UNIX support).

I see the libcurl code has most of it's test for Unix-domain
sockets inside a '#ifdef USE_UNIX_SOCKETS', so 'AF_UNIX' won't be
possible now for 'USE_WINSOCK' code w/o a major rewrite.

No mention of  in the blog, but a new  should
do the same. I'll download the new "Win-10 17069-SDK" and check.

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

Re: AW: Problem/Crash with libCurl Daily Snapshot and Option CURLSHOPT_SHARE and Parameter CURL_LOCK_DATA_CONNECT

2017-11-29 Thread Gisle Vanem via curl-library

Patrick Dawson wrote:


static void ShareLockFunc( CURL* pHandle, curl_lock_data Data, curl_lock_access 
Access, void* pUseptr )
{
...
}

static void ShareUnlockFunc( CURL* pHandle, curl_lock_data Data, void* pUseptr )
{
...
}


Vanem, Gisle wrote:
What are these used for?


In my understanding they are used to lock the access to the shared handle. 


Yes, I know. But you forgot to use those lock-options. I've made a
patch for you:)

@@ -73,6 +73,8 @@

 CURLSH *pShare = curl_share_init();
 curl_share_setopt( pShare, CURLSHOPT_SHARE, CURL_LOCK_DATA_CONNECT );
+curl_share_setopt( pShare, CURLSHOPT_LOCKFUNC, ShareLockFunc);
+curl_share_setopt( pShare, CURLSHOPT_UNLOCKFUNC, ShareUnlockFunc);



Crash 2:
hash.c: 114
struct curl_llist *l = FETCH_LIST(h, key, key_len); // h is 0


Looks very much like this issue:
  https://github.com/curl/curl/pull/712

Fixed last year though. Your subject says "libCurl Daily Snapshot".
So I assume you're using libcurl from a few days ago (?)

Is this a 64-bit version? I also tried your sample on 64-bit;
no problems there either.

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

Re: Problem/Crash with libCurl Daily Snapshot and Option CURLSHOPT_SHARE and Parameter CURL_LOCK_DATA_CONNECT

2017-11-28 Thread Gisle Vanem via curl-library

Dawson, Patrick wrote:


static void ShareLockFunc( CURL* pHandle, curl_lock_data Data, curl_lock_access 
Access, void* pUseptr )
{
...
}

static void ShareUnlockFunc( CURL* pHandle, curl_lock_data Data, void* pUseptr )
{
...
}


What are these used for?
I assume if you compile with MSVC, that you've added '-EHsc'
to your CFLAGS (otherwise the 'throw' isn't safe).

And BTW, your example works fine for me. Can you show some
callstack? E.g. "cdb -c g share-lock-example.exe".

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

Re: Adding QUIC support to curl

2017-10-31 Thread Gisle Vanem via curl-library

Lucas Pardue wrote:


Some nice discussion going on, just wanted to bump the visibility of the curl
QUIC wiki page.


Whoops, the page is located at https://github.com/curl/curl/wiki/QUIC.


That lists:
  ngtcp2 (C-library)
  MozQuic (C++ library)
  quicly (C-library)
  LiteSpeed QUIC client (C-library)

I took a brief look at how those are supporting Windows.
Seems non of them are at the moment; including headers like
 and . But it could be trivial to
fix?

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

Re: Enabled multiple SSL backends

2017-08-30 Thread Gisle Vanem via curl-library

Daniel Stenberg wrote:


On Tue, 29 Aug 2017, Gisle Vanem via curl-library wrote:


works perfectly. But with a "set CURL_SSL_BACKEND=cyassl" it does not:
 curl: (35) SSL_connect failed with error -313: revcd alert fatal error

I'm looking into it here.


Okay. If you get stuck and need some assistance, I think you'll get Johannes' attention best if you file a github issue 
and cc/ping him there.


It works now; rebuilt from yesterdays repo. Except with:
  set CURL_SS_BACKEND=wolfssl
  curl -v https://www.ssllabs.com/ssltest/viewMyClient.html

SSLlabs report:
  Failed to process your browser's SSL/TLS handshake.
  Sorry. We have recorded the raw data for investigation.

But not complains with 'https://google.com'.

PS. It would be nice if 'curl -v' could tell what SSL-backend
was used. Only 'schannel' makes it obvious.

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

Re: Enabled multiple SSL backends

2017-08-29 Thread Gisle Vanem via curl-library

Daniel Stenberg wrote:

To build with multiple backends, just specify all you want on the configure line. Ie "--with-ssl --with-gnutls" builds 
with both OpenSSL *and* GnuTLS.


Tell configure which backend to use by default when built to use several, with 
--with-default-ssl-backend.


I tried it on Windows (MSVC). No configure, so a bit of tweaking was needed.
I built with "OpenSSL", "SChannel" and "WolfSSL" (and -DCURL_WITH_MULTI_SSL)
and a:
  set CURL_SSL_BACKEND=schannel (or openssl)
  curl -v https://google.com

works perfectly. But with a "set CURL_SSL_BACKEND=cyassl" it does not:
  curl: (35) SSL_connect failed with error -313: revcd alert fatal error

I'm looking into it here.


Questions?


In curl.h there is:
  CURLSSLBACKEND_CYASSL = 7,
  ..
  #define CURLSSLBACKEND_WOLFSSL 6

Shouldn't that be:
  #define CURLSSLBACKEND_WOLFSSL 7

since WolfSSL once was named CyaSSL?

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

Comments in _netrc

2017-08-02 Thread Gisle Vanem via curl-library

For testing, I needed to comment out a line in my
'%HOME/_netrc' file. Like:

#machine tablet-pc  login foo   password bar1
 machine tablet-pc  login foo   password bar2

I was surprised to see that curl/libcurl even with
this edit, a command like 'curl ftp://tablet-pc ..' would
send the password "bar1".

I.e. lib/netc.c ignores the comment char '#'! Can this
please be fixed? Something like:

--- a/netrc.c 2016-11-22 14:33:03
+++ b/netrc.c 2017-08-02 11:27:18
@@ -119,6 +119,8 @@

 while(!done && fgets(netrcbuffer, netrcbuffsize, file)) {
   tok=strtok_r(netrcbuffer, " \t\n", _buf);
+  if (tok && *tok == '#')
+ continue;
   while(!done && tok) {

BTW.
It's also confusing that '%HOME%/.netrc' is NOT
supported on Windows. An old issue on Win-9x perhaps?
It would be great that '%HOME/_netrc' only said:
  include %HOME/.netrc

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

smb.c and remote-time

2017-07-04 Thread Gisle Vanem via curl-library

Regarding added SMB-test in
https://github.com/curl/curl/pull/1630,

it's nice to see SMB is getting some focus (although I'm not able to run
these tests on my StrawberryPerl).

2 problems in smb.c AFAICS:

1) '_getpid()' is not a valid function in djgpp/MSDOS. Simple fix:

--- a/smb.c 2017-07-04 11:24:33
+++ b/smb.c 2017-07-04 12:42:10
@@ -31,12 +31,12 @@
   #define BUILDING_CURL_SMB_C

   #ifdef HAVE_PROCESS_H
-#include 
-#ifdef CURL_WINDOWS_APP
-#define getpid GetCurrentProcessId
-#else
-#define getpid _getpid
-#endif
+  #include 
+  #ifdef CURL_WINDOWS_APP
+#define getpid GetCurrentProcessId
+  #elif !defined(MSDOS)
+#define getpid _getpid
+  #endif
   #endif

   #include "smb.h"


2) A "curl --remote-time .." does nothing for smb://.
Seems to be a matter of using the 'smb_nt_create_response::last_change_time'
struct-member. The attached diff seems to work here.

A test like:
   curl --remote-time -o test-file --libcurl - smb://host/Users/Public/test-file
shows
  ...
  curl_easy_setopt(hnd, CURLOPT_FILETIME, 1L);

And the timestamp after the D/L seems okay.

--
--gv


--- a/smb.c 2017-07-04 11:24:33
+++ b/smb.c 2017-07-04 12:42:10
@@ -31,12 +31,12 @@
 #define BUILDING_CURL_SMB_C

 #ifdef HAVE_PROCESS_H
-#include 
-#ifdef CURL_WINDOWS_APP
-#define getpid GetCurrentProcessId
-#else
-#define getpid _getpid
-#endif
+  #include 
+  #ifdef CURL_WINDOWS_APP
+#define getpid GetCurrentProcessId
+  #elif !defined(MSDOS)
+#define getpid _getpid
+  #endif
 #endif

 #include "smb.h"
@@ -715,6 +715,23 @@
   return CURLE_OK;
 }

+/*
+ * Convert a timestamp from the Windows world (100 nsec units from
+ * 1 Jan 1601) to Posix time.
+ */
+static void get_posix_time (long *_out, const void *_in)
+{
+#ifdef HAVE_LONGLONG
+  long long time = *(long long *) _in;
+#else
+  unsigned __int64 time = *(unsigned __int64 *) _in;
+#endif
+
+  time -= 1164447360ULL;
+  time /= 1000;
+  *_out = (long) time;
+}
+
 static CURLcode smb_request_state(struct connectdata *conn, bool *done)
 {
   struct smb_request *req = conn->data->req.protop;
@@ -725,6 +742,7 @@
   unsigned short off;
   CURLcode result;
   void *msg = NULL;
+  const struct smb_nt_create_response *smb_m;

   /* Start the request */
   if(req->state == SMB_REQUESTING) {
@@ -767,7 +785,8 @@
   next_state = SMB_TREE_DISCONNECT;
   break;
 }
-req->fid = smb_swap16(((struct smb_nt_create_response *)msg)->fid);
+smb_m = (const struct smb_nt_create_response*) msg;
+req->fid = smb_swap16(smb_m->fid);
 conn->data->req.offset = 0;
 if(conn->data->set.upload) {
   conn->data->req.size = conn->data->state.infilesize;
@@ -775,9 +794,11 @@
   next_state = SMB_UPLOAD;
 }
 else {
-  conn->data->req.size =
-smb_swap64(((struct smb_nt_create_response *)msg)->end_of_file);
+  smb_m = (const struct smb_nt_create_response*) msg;
+  conn->data->req.size = smb_swap64(smb_m->end_of_file);
   Curl_pgrsSetDownloadSize(conn->data, conn->data->req.size);
+  if(conn->data->set.get_filetime)
+get_posix_time (>data->info.filetime, _m->last_change_time);
   next_state = SMB_DOWNLOAD;
 }
 break;
---
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html

Re: examples in ALL libcurl option man pages!

2017-05-31 Thread Gisle Vanem via curl-library

Daniel Stenberg wrote:


I'm sure there are mistakes too so keep on filing bugs when you find them!


Great work. Some typos:
  CURLOPT_SSH_KEYDATA.3:
statoc int keycb(CURL *easy,

  CURLOPT_SSH_KEYFUNCTION.3:
   statoc int keycb(CURL *easy,

's/statoc/static/g'

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

Re: curl can not stop sending after it received FIN

2017-04-12 Thread Gisle Vanem via curl-library

Tanyaofeng wrote:


4.We found an issue:

The file server was shut down during sending  file data, the curl can’t stop 
sending data after it received FIN from
Http Proxy Server until file data was sent finished.


If this was a serious issue, it would have been fixed
years ago. Use netstat (or Process Explorer etc.) and you probably see
curl's socket is in CLOSE_WAIT state.

Read here on the subject of a "half-open TCP connection":
  
https://superuser.com/questions/298919/what-is-tcp-half-open-connection-and-tcp-half-closed-connection

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

Re: curl/libcurl SNMP protocol support

2016-08-10 Thread Gisle Vanem via curl-library
Sergei Nikulov wrote:

> curl will dump object pointed by url 
> snmp://example.com/common/1.3.6.1.2.1.1.3.0
> It's not just another protocol :)

I once did something like this. But only for Windows-SNMP.
Not very useful with libcurl either (mostly for the trace).
But here it is:
  https://gist.github.com/gvanem/6c7b43fc694f0e26e3e56e99714888c7

And here 'snmpmgr.exe -v snmp://router/1.3.6.1.2.1.1.1.0' gives:
...
* STATE: CONNECT => WAITRESOLVE handle 0x3903ec0; line 1433 (connection #0)
*   Trying 10.0.0.1...
* Could not set TCP_NODELAY: Invalid arguments << [1]
* STATE: WAITRESOLVE => WAITCONNECT handle 0x3903ec0; line 1514 (connection #0)
* Connected to router (10.0.0.1) port 161 (#0)
* STATE: WAITCONNECT => SENDPROTOCONNECT handle 0x3903ec0; line 1556 
(connection #0)
* Marked for [keep alive]: HTTP default
* STATE: SENDPROTOCONNECT => DO handle 0x3903ec0; line 1574 (connection #0)
* STATE: DO => DONE handle 0x3903ec0; line 1615 (connection #0)
* multi_done
* Connection #0 to host router left intact
* Expire cleared
String: Linux Snurre-Router 3.2.41-svn21039 #101 Mon Mar 25 10:30:36 CET 2013 
mips



[1] Winsock doesn't allow this on a SOCK_DGRAM socket.

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

Re: The "Great Firewall of China"

2016-06-18 Thread Gisle Vanem via curl-library
Dan Fandrich wrote:

> I think it's ironic that not only does this protest requires loading arbitrary
> Javascript from a third-party site, but it's served unencrypted and
> unauthenticated and is therefore vulnerable to active manipulation by a
> malicious party while in transit.

Why is this so ironic? You're not trusting the firewall
status of China is accurate?

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

The "Great Firewall of China"

2016-06-17 Thread Gisle Vanem via curl-library
Did you folks know that github.com is blocked by the "Great Firewall of China"?
Check here:
  http://www.greatfirewallofchina.org/index.php?siteurl=github.com

But www.haxx.se is not:
  http://www.greatfirewallofchina.org/index.php?siteurl=www.haxx.se

So I'd urge you Daniel to consider protesting against this
Chinese stupidity by adding this simple JavaScript to some
libcurl-pages under haxx.se:
  http://www.greatfirewallofchina.org/banner/gfoc_banner.js";>
  

Before the ''. The result will look like in the
attached screen-shoot (from Chrome on Win-10). Read their FAQ to
see why we should bother:
  http://www.greatfirewallofchina.org/faq.php

-- 
--gv



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

[Patch] curl_multibyte.c

2016-05-20 Thread Gisle Vanem via curl-library
Since Github seems to have git problems at the moment, I create
this issue here. While compiling lib/curl_multibyte.c with
'-DUSE_WIN32_IDN' etc. I was getting:

  f:\mingw32\src\inet\curl\lib\memdebug.h(38): error C2054: expected '(' to 
follow 'CURL_EXTERN'
  f:\mingw32\src\inet\curl\lib\memdebug.h(38): error C2085: 'curl_domalloc': 
not in formal parameter list
  ...
  Internal Compiler Error in f:\gv\VC_2015\bin\cl.exe.  You will be prompted to 
send an error report
  to Microsoft later.
  INTERNAL COMPILER ERROR in 'f:\gv\VC_2015\bin\cl.exe'
  Please choose the Technical Support command on the Visual C++
  Help menu, or open the Technical Support help file for more information

---

The fix was easy though:

--- a/curl_multibyte.c 2016-02-05 07:58:12
+++ b/curl_multibyte.c 2016-05-20 09:48:51
@@ -22,6 +22,8 @@

 #include "curl_setup.h"

+#include 
+
 #if defined(USE_WIN32_IDN) || ((defined(USE_WINDOWS_SSPI) || \
 defined(USE_WIN32_LDAP)) && defined(UNICODE))


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