Commit Graph

59 Commits

Author SHA1 Message Date
Marcel Raad 9e5669f388
tool: support UTF-16 command line on Windows
- use `wmain` instead of `main` when `_UNICODE` is defined [0]
- define `argv_item_t` as `wchar_t *` in this case
- use the curl_multibyte gear to convert the command-line arguments to
  UTF-8

This makes it possible to pass parameters with characters outside of
the current locale on Windows, which is required for some tests, e.g.
the IDN tests. Out of the box, this currently only works with the
Visual Studio project files, which default to Unicode, and winbuild
with the `ENABLE_UNICODE` option.

[0] https://devblogs.microsoft.com/oldnewthing/?p=40643

Ref: https://github.com/curl/curl/issues/3747
Closes https://github.com/curl/curl/pull/3784
2020-05-14 18:13:36 +02:00
Daniel Stenberg 05b1b35085
nit: Copyright year out of date
Follow-up to 1fc0617dcc
2020-02-19 08:04:35 +01:00
Jay Satiro 1fc0617dcc tool_util: Improve Windows version of tvnow()
- Change tool_util.c tvnow() for Windows to match more closely to
  timeval.c Curl_now().

- Create a win32 init function for the tool, since some initialization
  is required for the tvnow() changes.

Prior to this change the monotonic time function used by curl in Windows
was determined at build-time and not runtime. That was a problem because
when curl was built targeted for compatibility with old versions of
Windows (eg _WIN32_WINNT < 0x0600) it would use GetTickCount which wraps
every 49.7 days that Windows has been running.

This change makes curl behave similar to libcurl's tvnow function, which
determines at runtime whether the OS is Vista+ and if so calls
QueryPerformanceCounter instead. (Note QueryPerformanceCounter is used
because it has higher resolution than the more obvious candidate
GetTickCount64). The changes to tvnow are basically a copy and paste but
the types in some cases are different.

Ref: https://github.com/curl/curl/issues/3309

Closes https://github.com/curl/curl/pull/4847
2020-02-18 15:52:13 -05:00
Daniel Stenberg c6deecd7e9
curl: use errorf() better
Change series of error outputs to use errorf().

Only errors that are due to mistakes in command line option usage should
use helpf(), other types of errors in the tool should rather use
errorf().

Closes #4691
2019-12-10 10:03:33 +01:00
Daniel Stenberg 6ee9e4bd47
cleanup: s/curl_debug/curl_dbg_debug in comments and docs
Leftovers from the function rename back in 76b6348949

Reported-by: Gisle Vanem
Bug: f3e0f071b1 (com)
mitcomment-34601751

Closes #4203
2019-08-08 16:01:00 +02:00
Daniel Stenberg b889408500
curl: support parallel transfers
This is done by making sure each individual transfer is first added to a
linked list as then they can be performed serially, or at will, in
parallel.

Closes #3804
2019-07-20 19:14:16 +02:00
Marcel Raad d1b5cf830b
build: fix Codacy/CppCheck warnings
- remove unused variables
- declare conditionally used variables conditionally
- suppress unused variable warnings in the CMake tests
- remove dead variable stores
- consistently use WIN32 macro to detect Windows

Closes https://github.com/curl/curl/pull/3739
2019-04-11 21:08:44 +02:00
Daniel Stenberg 76b6348949
memdebug: make debug-specific functions use curl_dbg_ prefix
To not "collide" or use up the regular curl_ name space. Also makes them
easier to detect in helper scripts.

Closes #3656
2019-03-08 23:21:21 +01:00
Daniel Stenberg 8e2549b86c
tool_main: rename function to make it unique and better
... there's already another function in the curl tool named
free_config_fields!
2018-11-30 12:02:27 +01:00
Jay Satiro 397664a065 tool: add undocumented option --dump-module-paths for win32
- Add an undocumented diagnostic option for Windows to show the full
  paths of all loaded modules regardless of whether or not libcurl
  initialization succeeds.

This is needed so that in the CI we can get a list of all DLL
dependencies after initialization (when they're most likely to have
finished loading) and then package them as artifacts so that a
functioning build can be downloaded. Also I imagine it may have some use
as a diagnostic for help requests.

Ref: https://github.com/curl/curl/pull/3103

Closes https://github.com/curl/curl/pull/3208
2018-11-06 03:15:44 -05:00
Yasuhiro Matsumoto 5bfaa86ceb
curl: fixed UTF-8 in current console code page (Windows)
Fixes #3211
Fixes #3175
Closes #3212
2018-11-05 09:58:29 +01:00
Daniel Stenberg ae925ddcc3
tool_main: make TerminalSettings static
Reported-by: Gisle Vanem
Bug: becfe1233f (commitcomment-31008819)
Closes #3161
2018-10-26 00:59:50 +02:00
Rich Turner becfe1233f
curl: enabled Windows VT Support and UTF-8 output
Enabled Console VT support (if running OS supports VT) in tool_main.c.

Fixes #3008
Closes #3011
2018-09-29 12:39:41 +02:00
Daniel Stenberg f3d836b736
curl: added --styled-output
It is enabled by default, so --no-styled-output will switch off the
detection/use of bold headers.

Closes #2538
2018-05-21 20:29:12 +02:00
Marcel Raad 88220adb72
tool_main: turn off MinGW CRT's globbing
By default, the MinGW CRT globs command-line arguments. This prevents
getting a single asterisk into an argument as test 1299 does. Turn off
globbing by setting the global variable _CRT_glob to 0 for MinGW.

Fixes https://github.com/curl/curl/issues/1751
Closes https://github.com/curl/curl/pull/1813
2017-08-22 09:21:23 +02:00
Daniel Stenberg 5385450afd curl: prevent binary output spewed to terminal
... unless "--output -" is used. Binary detection is done by simply
checking for a binary zero in early data.

Added test 1425 1426 to verify.

Closes #1512
2017-06-16 23:38:13 +02:00
Daniel Stenberg 4af40b3646 URLs: change all http:// URLs to https:// 2016-02-03 00:19:02 +01:00
John E. Malmberg f9cf3de70b VMS: Updates for 0740-0D1220
lib/setup-vms.h : VAX HP OpenSSL port is ancient, needs help.
                  More defines to set symbols to uppercase.

src/tool_main.c : Fix parameter to vms_special_exit() call.

packages/vms/ :
  backup_gnv_curl_src.com : Fix the error message to have the correct package.

  build_curl-config_script.com : Rewrite to be more accurate.

  build_libcurl_pc.com : Use tool_version.h now.

  build_vms.com : Fix to handle lib/vtls directory.

  curl_gnv_build_steps.txt : Updated build procedure documentation.

  generate_config_vms_h_curl.com :
       * VAX does not support 64 bit ints, so no NTLM support for now.
       * VAX HP SSL port is ancient, needs some help.
       * Disable NGHTTP2 for now, not ported to VMS.
       * Disable UNIX_SOCKETS, not available on VMS yet.
       * HP GSSAPI port does not have gss_nt_service_name.

  gnv_link_curl.com : Update for new curl structure.

  pcsi_product_gnv_curl.com : Set up to optionally do a complete build.
2014-12-21 16:55:28 +01:00
Kamil Dudka 0cd368c2ef tool: oops, forgot to include <plarenas.h>
... that contains the declaration of PL_ArenaFinish()
2014-07-03 20:36:49 +02:00
Kamil Dudka d343033f3d tool: call PL_ArenaFinish() on exit if NSPR is used
This prevents valgrind from reporting still reachable memory allocated
by NSPR arenas (mainly the freelist).

Reported-by: Hubert Kario
2014-07-03 20:27:20 +02:00
Kamil Dudka 24c3cdce88 tool: call PR_Cleanup() on exit if NSPR is used
This prevents valgrind from reporting possibly lost memory that NSPR
uses for file descriptor cache and other globally allocated internal
data structures.
2014-07-02 18:11:05 +02:00
Steve Holme f1a9e6858e tool: Moved --libcurl to the global config 2014-03-01 17:23:14 +00:00
Steve Holme 5513bbd5c3 tool: Moved --stderr to the global config 2014-03-01 13:03:20 +00:00
Dan Fandrich bd248a0b80 tool_main: Fixed a memory leak on main_init error 2014-02-28 21:58:12 +01:00
Steve Holme 4efa1d29e2 tool: Moved --trace and --verbose to the global config 2014-02-27 21:01:08 +00:00
Steve Holme fd97c17bb7 tool_main: Forgot to initialise the first operation's global pointer 2014-02-27 20:49:28 +00:00
Steve Holme 249dc83571 tool: Moved --showerror to the global config
Other global options such as --libcurl, --trace and --verbose to
follow.
2014-02-25 20:52:36 +00:00
Steve Holme c27cc68815 tool_operate: Moved easy handle cleanup into tool_main 2014-02-24 20:35:48 +00:00
Steve Holme 59b5ef444e tool_main: Moved easy handle into global config structure 2014-02-24 20:01:37 +00:00
Steve Holme cc31a4a645 tool_main: Corrected typo from commit d6b9f054e9 in Symbian code 2014-02-23 14:10:05 +00:00
Steve Holme 665096e24c tool_main: Moved OperateConfig cleanup into main_free() 2014-02-23 13:44:59 +00:00
Steve Holme d6b9f054e9 tool_main: Moved initial OperateConfig creation into main_init() 2014-02-23 13:35:51 +00:00
Steve Holme 2249f7fe70 tool_cfgable: Added global config structure 2014-02-23 13:12:47 +00:00
Steve Holme 705a4cb549 tool_cfgable: Renamed Configurable structure to OperationConfig
To allow for the addition of a global config structure and prevent
confusion between the two.
2014-02-23 13:09:20 +00:00
Steve Holme b914e7ed02 tool_operate: Start to use CURLcode rather than int for return codes
To help assist with the detection of incorrect return codes, as per
commits ee23d13a79, 33b8960dc8 and aba98991a5, updated the operate
based functions to return CURLcode error codes.
2014-02-22 18:57:02 +00:00
Steve Holme 132f5edfbd tool_getparam: Added support for parsing of specific URL options 2014-02-08 11:18:25 +00:00
Steve Holme a3a6b03c30 tool_cfgable: For consistency renamed init_config() to config_init() 2014-02-07 21:27:12 +00:00
Steve Holme 3b929b6a65 tool_cfgable: Introduced config_free() function 2014-02-07 21:22:46 +00:00
Steve Holme 6127e54f40 tool_operate: Moved libcurl information gathering to tool_main 2014-02-03 22:56:58 +00:00
Steve Holme b811200f64 tool_operate: Moved main initialisation and cleanup code into tool_main 2014-02-03 12:31:16 +00:00
Steve Holme c1daf6c0cd tool_main: Fixed compilation warning from commit 0104678c79
no previous prototype for function 'memory_tracking_init'
2014-02-03 12:16:22 +00:00
Steve Holme cf80b85b66 tool_main: Changed stack based config struct to be heap based 2014-02-03 10:54:40 +00:00
Steve Holme 0104678c79 tool_operate: Moved memory tracking initialisation into tool_main 2014-02-02 13:48:36 +00:00
Steve Holme 83dbd06936 tool_main: Moved config struct initialisation into a separate function
In preparation for adding URL specific options moved the initialisation
of the Configurable structure into a separate function in tool_cfgable.
2014-02-01 13:44:00 +00:00
Kamil Dudka 683f2b8323 src/Makefile.am: build static lib for unit tests if enabled 2013-05-06 15:03:12 +02:00
Yang Tse 911b2d3f67 tool_main.c: remove redundant vms_show storage-class specifier
vms_show 'extern' storage-class specifier removed from tool_main.c due to...

- Advice from Tor Arntsen: http://curl.haxx.se/mail/lib-2013-03/0164.html

- HP OpenVMS docs stating that 'Extern is the default storage class for
  variables declared outside a function.'
  http://h71000.www7.hp.com/commercial/c/docs/dec_c_help_5.html
  (Storage_Classes section)
2013-03-13 23:35:24 +01:00
Tom Grace 17c088fb45 tool_main.c: fix VMS global variable storage-class specifier
An extern submits a psect and a global reference to the linker to point
to it. Using "extern int vms_show = 0" also creates a globaldef.

The use of the extern by itself does declare a psect but does not declare
a globalsymbol. It does declare a globalref. But the linker needs one and
only one globaldef or there is an error.
2013-03-13 03:13:52 +01:00
Yang Tse 453e821ad7 vms_show: post VMS patch cleanup - II
- remove multiple declarations of vms_show and add comments
2013-02-06 04:51:55 +01:00
Yang Tse e0c491026f tool_main.c: post VMS patch cleanup - I
- remove header inclusion already done in curl_setup_once.h
2013-02-06 04:51:00 +01:00
John E. Malmberg 25f351424b VMS: fix and generate the VMS build config
config_h.com is a new file that generates a config.h file based on the
curl_config.h.in file and a quick scan of the configure script.  This is
actually a generic procedure that is shared with other VMS packages.

The existing pre-built config-vms.h had over 100 entries that were not
correct and in some cases conflicted with the build options available in
the build_vms.com.

generate_config_vms_h_curl.com is a helper procedure to the
config_h.com.  It covers the cases that the generic config_h.com is not
able to figure out, and accepts input from the build_vms.com procedure.

build_curlbuild_h.com is a new file to generate the curlbuild.h file
that Curl is now using when it is using a curl_config.h file.

post-config-vms.h is a new file that is needed to provide VMS specific
definitions, and most of them need to be set before the system header
files are included.

The VMS build procedure is fixed:

   1. Fixed to link in the correct HP ssl library.
   2. Fixed to detect if HP Kerberos is installed.
   3. Fixed to detect if HP LDAP is installed.
   4. Fixed to detect if gnv$libzshr is installed.
   5. Simplified the input parameter parsing to not use a loop.
   6. Warn that 64 bit pointer option support is not complete
      in comments.
   7. Default to IEEE floating if platform supports it so
      resulting libcurl will be compatible with other
      open source projects on VMS.
   8. Default to LARGEFILE if platform supports it.
   9. Default to enable SSL, LDAP, Kerberos, libz
      if the libraries are present.
   10. Build with exact case global symbols for libcurl.
   11. Generate linker option file needed.
   12. Compiler list option only commonly needed items.
   13. fulllist option for those who really want it.
   14. Create debug symbol file on Alpha, IA64.
2013-02-05 23:08:57 +01:00