eaiovnaovbqoebvqoeavibavo PK:iZ#+z+z$doc/freetds/ea-freetds-1.4.9/NEWS.mdnu[$Id: 4d8b89247d1fb609bbe1761c3c1a430b125e76ba $ Summary of Changes in release 1.4 -------------------------------------------- User visible (not in a particular order): - Fix some numeric conversion checks; - Always use Unicode for SSPI allowing not ASCII to work; - Improve BCP copy, especially for Sybase; - Better error reporting for ICONV failures; - Disable TLSv1 by default; - ODBC: partial TVP support (missing data at execution); - ODBC: support for quoted string in connection string; - CT-Library: support large identifiers; - CT-Library: report appropriate severity values; - apps: datacopy report errors on standard error; - pool: use poll instead of select to support more connections. Implementation: - Use more bool type for boolean instead of integer; - more macros for ODBC tests to encapsulate some ODBC API. Summary of Changes in release 1.3 -------------------------------------------- User visible (not in a particular order): - Generic: - Support UTF-8 columns using MSSQL 2019; - Do not accept TDS protocol versions "4.6" (never really supported) and "8.0"; - Minor portability issues; - Fix log elision for login; - Detect some possible minor memory failure in application; - Support long (more than 64k) SSPI packets (never encountered but you never know); - Fix unicode columns for ASA database; - Avoid using BCP with old protocols; - (\*) Fix bulk copy using big endian machines; - (\*) Fix Sybase uni(var)char and unsigned types for big endian machines; - (\*) Do not send nullable data during bulk copy if type is not nullable; - ODBC: - Added "Timeout" setting; - Applications: - Improve defncopy utility: - Fix some declaration; - Fix Sybase support; - (\*) Fix datacopy and freebcp logging ; - CT-Library: - Minor fix for variant type; - Better support for timeout setting; - (\*) Support some missing types (like nullable unsigned integers) for Sybase; - DB-library: - Unify date format (all systems can use the same syntax); - (\*) Allows to pass 0 as type for bcp_bind; - (\*) Fix DBSETLSERVERPRINCIPAL macro; - (\*) Do not limit queries length for bcp using Sybase; - (\*) Add KEEP_NULLS to BCP hints. (\*) Feature backported in stable 1.2 branch. Implementation: - Move replacement headers under freetds directory for coherence with other internal headers; - Lot of style updates; - Optimize UTF-8 encoding for ODBC, reuse common code. Summary of Changes in release 1.2 -------------------------------------------- User visible (not in a particular order): - Sybase server: - All strings are now converted as MSSQL; - Support kerberos login; - DB-Library: add DBSETNETWORKAUTH, DBSETMUTUALAUTH, DBSETDELEGATION and DBSETSERVERPRINCIPAL; - CT-Library: add CS_SEC_NETWORKAUTH, CS_SEC_NETWORKAUTH, CS_SEC_NETWORKAUTH and CS_SEC_NETWORKAUTH; - Bulk copies: - DB-Library: fix trim of unicode fields; - (\*) Apply character conversion for Sybase, like MSSQL; - (\*) Ignore computed columns; - (\*) Properly support multibyte strings in column names; - (\*) DB-Library: stop correctly on BCPMAXERRS setting; - (\*) DB-Library: do not try to convert skipped rows reading file allowing for instance to load CVS files; - (\*) CT-Library: added CS_DATABASE property to allows to connect correctly to Azure servers; - (\*) Improve support for MS XML columns for both DB-Library and CT-Library; - (\*) Fix some issues with MSSQL server redirection (used for instance in Azure); - (\*) Change SQL_DESC_OCTET_LENGTH value for wise character columns; - Better support for SQL_VARIANT: - Better column checks; - (\*) CT-Library: now supported, columns are returned as CS_CHAR_TYPE; - Some updates to server part: - Set correctly initial state; - IPv6 support; - Fix TDS 7.2 logins; - Support extended character using domain logins under Unix; - Improve MARS: - Less memory copies; - (\*) Remove possible deadlock; - Handle wrapping sequence/window numbers; - Make sure we sent the wanted packet; - (\*) Support UTF-16 surrogate pairs in odbc_wide2utf and odbc_set_string_flag fixing some character encoding support; - (\*) Fix multiple queries, used by ODBC to optimize data load; - (\*) Improve emulated parameter queries, fixing minor issues and reducing memory usage; - Support DBVERSION_UNKNOWN in dbsetlversion (will use automatic detection); - CT-Library: define CS_MIN_SYBTYPE and CS_MAX_SYBTYPE; - (\*) CT-Library: fix cs_will_convert accepting library constants, not libTDS. (\*) Feature backported in stable 1.1 branch. Implementation: - User guide converted to XML; - Always use little endian on network level, simpler and faster; - Converted some files to markdown; - Optimize bytes endianess conversion; - Made character lookup faster making character conversion quicker; - Optimize data padding in CT-Library; - Fix some build dependencies causing some files to not be properly recompiled during development; - Add "freeze" support allowing to pause sending in order to simplify lengths computations sending data. Summary of Changes in release 1.1 -------------------------------------------- User visible (not in a particular order): - Changed default TDS protocol version during configure to "auto". Versions 4.2 and 7.0 are no longer accepted for default, you may still specify an explicit version to connect to obsolete servers ("auto" won't attempt these versions); - allows to disable TLS 1.0 support; - pool server allows to specify different username/password for server and clients allowing to hide internal server logins; - tsql utility now send final partial query to server to avoid to have to specify a final "GO" line to terminate commands; - better support for Microsoft cluster, client will attempt multiple connection to server at the same time if DNS reply multiple IPs; - MONEY/SMALLMONEY types are now formated with 4 decimal digits to avoid truncation; - MARS support is now compiled by default; - pool server is now compiled by default; - Fixed SQL_ATTR_LOGIN_TIMEOUT for ODBC; - Fixed large integer numbers for ODBC RPC constants; - Fixed encrypted logins if "auto" protocol version is used; - Support CS_TIMEOUT, CS_LOGIN_TIMEOUT and CS_CLIENTCHARSET properties under CTLibrary; - Added a dbacolname function in DBLibrary, similar to dbcolname but for compute columns (mainly for Sybase now, Microsoft removed support for compute columns); - NTLMv2 is now on by default. Implementation: - Improved UTF-8 performances; - Use more stdint.h style definitions (like uint32_t); - Use bool type instead of int; - pool server compile under Windows too (not as capable as Unix version); - CMake build is now able to do an installation; - Added a src/utils directory to collect all common code not strictly related to replacements or TDS; - Simplified makefiles; - Support CP1252 encoding in internal trivial iconv; - Better ODBC detection. Allows to specify a directory with --with-iodbc to specify custom iOBDC. Summary of Changes in release 1.0 -------------------------------------------- User visible (not in a particular order): - Removed "8.0" from protocol version string accepted. Please update configuration files; - Default protocol version is now auto. This could slow down connection but make user experience less painful; - Sybase encrypted login. Set encryption to get it; - Support protocol version 7.4; - Add intent support to specify we don't want to change data; - Allow to attach database file during the login (MS SQL Server); - Support for Sybase time/date/bigdate/bigdatetime; - Pool is working again; - ODBC BCP (not complete); - Improved dbconvert and dbconvert_ps (more compatible); - Fixed dbspid; - Improved ODBC type information; - Better certificate verification; - AppVeyor is used for every build; - Try all IPs from DNS. This allows SQL Cluster connection to secondary servers. Implementation: - Removed Nmake support; - Type conversions simplified; - Better type handle code. Summary of Changes in release 0.95 -------------------------------------------- User visible (not in a particular order): - Support for build with CMake under Windows. - Support MSSQL 2008: - new date/time types; - NBCROWs; - able to retrieve CLR UDT types in binary format. - Moved from CVS to git. - Support MARS under ODBC. - IPv6 support. - Support unsigned Sybase types. - Sybase use some characters conversion like MSSQL. - Bulk-copy improvements: - more types; - support for empty fields; - no needs for seekable file; - avoid possible buffer overflows; - less memory consumption; - handle different BIT fields in Sybase; - -T option for datacopy. - datacopy: - prompting for password (use "-" password on command line); - empty user/password (to use Kerberos). - Support for query notifications in ODBC. - Support for protocols 7.2 and 7.3 under dblib and ctlib. - dblib: - dbpivot extension; - dbprcollen extension to get printable column size; - add DBCOL2 structure for dbtablecolinfo; - support DBTEXTSIZE option for dbsetopt; - support SRCNUMERICBIND and SRCDECIMALBIND binding; - DATETIME2BIND extension binding to support new mssql 2008 type; - ODBC: - add SQL_INFO_FREETDS_TDS_VERSION option to SQLGetInfo to retrieve FreeTDS version; - add --enable-odbc-wide-tests configure option to use wide functions in unit tests. - Better thread support. - Allow to specify server SPN for GSSAPI. - Sybase graceful disconnects. - Better support for VARCHAR(MAX)/VARBINARY(MAX). - Better error reporting from login failure. - More strict test for configuration errors, fails if configuration is wrong. - "use utf-16" option to enable use of UTF-16 for server encoding (MSSQL). - Remove support for Dev-C++. - Remove support for bad iconv, use libiconv instead (Tru64 and HP-UX should be affected), connect will fail. - New NTLM options: - "use lanman"; - "use ntlmv2". - New Kerberos options: - "realm" ("REALM" in ODBC); - "spn" ("ServerSPN" in ODBC). - New certificate options: - "ca file"; - "crl file"; - "check certificate hostname". - Many bug fixes, majors: - SSPI with Kerberos on some setup; - SQLCancel threading; - ctlib numeric; - ODBC statistic function quotings. Implementation: - Introdude streams support to make easier handling large data and making conversions faster. - Use array of flags to make faster to retrieve data type features. - Use callbacks for handling various type functions. - Optimize data conversions. - Store TDS packets in a new structure to handle multiple packets. - New DSTR implementation which use less memory. - Faster logging. - Put mostly data handling in src/tds/data.c. - Move mostly headers to include/freetds directory. - Add a include/freetds/proto.h header to separate protocol declarations. - Add src/tds/packet.c to separate code handling TDS packets. - Modify libTDS error codes, not only TDS_FAIL. - Use DSTR for names in TDSCOLUMN. - Generate graphs in Doxygen. Summary of Changes in release 0.91 -------------------------------------------- 1. Full Kerberos and SSPI support for passwordless login to Microsoft SQL Server from Unix and Windows clients. Includes Kerberos delegation option. 2. Full support for DB-Library under Win32/64 via NMAKE.EXE. 3. Built-in support for UTF-8. 4. Support for wide characters in ODBC. 5. Support for varchar(max) and varbinary(max). 6. Better thread-safety in ODBC. 7. Distinguish between connect and login errors. 8. Bulk-copy functions in CT-Library. TDS versions now reflect Microsoft's nomenclature. The previous version numbers (8.0 and 9.0) are now 7.1 and 7.2. See the UG for details. Executive Summary of Changes in release 0.82 -------------------------------------------- 1. timeout handling 2. encrypted connections 3. fisql (and odbc utilities) 4. autoconf improvements 5. 23,710 lines added or deleted (101,022 total). 6. 85 files added 7. 21 unit tests added Details ------- db-lib - timeouts work! - corrected dbnextrow - implemented dbsetnull and dbsetinterrupt - improved error reporting and checking - fixed rpc parameter processing, now php works correctly ct-lib - added cs_loc_alloc, cs_loc_drop, cs_locale implementations odbc - cursors (mssql) - fixed database setting - return error always if odbc returns SQL_ERROR - fixed SQLGetData result utilities - added support for NUL characters inside terminators in freebcp - added row termination and column termination option to tsql - new fisql application - new ODBC utilities documentation - significant updates to TDS protocol documentation - freetds.conf man page - added tenderfoot sample code general - fixed timeout handling - added freetds.conf option for encryption - added protocol version discovery - NTLM2 session response - read table and real column name from wire - experimental Kerberos support using gssapi - some optimizations for GCC4 - optimized conversions avoiding some memory copy - minor improves to server stuff - improved MingW compile (even cross one) - more verbose log for dblib and odbc - many test added 1 test for libTDS 1 test for ctlib 3 tests for dblib 13 tests for odbc libTDS API changes - tds_add_row_column_size removed - tds_alloc_row return now TDS_SUCCEED/TDS_FAIL - tds_alloc_compute_row return now TDS_SUCCEED/TDS_FAIL - removed TDSCOLUMN->column_offset - added TDSCOLUMN->column_data and TDSCOLUMN->column_data_free - added TDSCURSOR->type and TDSCURSOR->concurrency for mssql support - added fetch_type and i_row parameters to tds_cursor_fetch - added tds_cursor_update and tds_cursor_setname functions - made tds_alloc_get_string static - removed tds_free_cursor - added TDSCURSOR->ref_count - added tds_cursor_deallocated and tds_release_cursor to handle cursor release. tds_cursor_deallocated is called when cursor got deallocated from server while tds_release_cursor is called to decrement reference counter. Reference counter is used cause is difficult to trace pointer owner between libTDS and upper libraries - added TDS_COMPILETIME_SETTINGS->sysconfdir - changed DSTR_STRUCT structure to include dstr_size - changed DSTR type - error handler cannot return TDS_INT_EXIT - removed TDSSOCKET->query_timeout_func TDSSOCKET->query_timeout_param, TDSSOCKET->query_start_time - changed TDSLOGIN->host_name to client_host_name - changed TDSCONNECTION->host_name to client_host_name - changed TDSLOGIN->encrypted to encryption_level - changed TDSCONNECTION->encrypted to encryption_level - added TDSRESULTINFO->row_free handler to free row - added TDSCONTEXT->int_handler handler - removed tds_prtype - removed tds_alloc_param_row - added tds_alloc_param_data - added flags parameter to tds7_send_auth - removed tds_client_msg - added tdserror to report error - added flags parameter to tds_answer_challenge - added is_variable_type macro - added TDSCOLUMN->table_column_name - added tds parameter to tds_set_column_type - renamed BCPCOLDATA->null_column to is_null - added TDSMESSAGE->oserr - remove length, number_upd_cols and cur_col_list from TDSCURSOR (never used) - added new TDSAUTHENTICATION to handle authentication modules - added TDSSOCKET->authentication - added tds_ntlm_get_auth and tds_gss_get_auth - removed TDSANSWER - removed tds7_send_auth (use new tds_ntlm_get_auth) - added tds_get_int8 - add TDSPARAMINFO *params argument to tds_cursor_declare - add TDSPARAMINFO *params argument to tds_cursor_open - changed TDSSOCKET->rows_affected from int to TDS_INT8 - added TDSSOCKET->tds9_transaction (used internally for TDS9) - added TDSCONNECTION->server_host_name needed for Kerberos support * 0.64 - core library - reduced network bandwidth use on Linux and *BSD - do not free TDSSOCKET in tds_connect - moved network stuff into net.c - fixed conversion NUMERIC->NUMERIC changing precision/scale - added named instance support (mssql2k) - fixed cancel and timeout - added support for encrypted connection using mssql (using either GnuTLS or OpenSSL) - improved numeric conversions performance - improved debug logging (added "debug flags" option) - ctlib - ct_dynamic and friends (placeholder support) - dblib - more functions - made threadsafe - improved bcp - support for large files using BCP - fixed buffering - ODBC - fixed compute handling in ODBC - paramset support - constant parameters in rpc (ie {?=call func(10,?)} ) - configure use automatically odbc_config if available - compatibility - improve PHP support - improve DBD::ODBC support - partial dos32 support - improve JDBC support - added msvc6 project to build dblib library on windows - support long password on tsql for all platforms - improved pool server - RPMs - ODBC driver registration (in odbcinst.ini) - better dependency for RedHat and SUSE - a lot of fixes libTDS API changes - tds_connect does not free TDSSOCKET* on failure - TDSSOCKET->env is not a pointer anymore - tds_free_compute_result and tds_free_compute_results are now static - added TDSDYNAMIC->next for linked list - removed TDSCURSOR->client_cursor_id - use TDSCURSOR* cursor instead of TDS_INT client_cursor_it in tds_cursor_* functions - added const char* file param to tdsdump_dump_buf and tdsdump_log and added line information in level - changed tds_alloc_compute_results declaration, pass a TDSSOCKET* - removed tds_do_until_done (not used) - removed tds_set_longquery_handler function (not used) - changed some fields in TDSSOCKET - removed out_len (not used) - renamed cursor to cursors - removed client_cursor_id - added cur_cursor (instead of removed client_cursor_id) - dyns now a pointer to a pointer to first dynamic allocated - removed num_dyns (now useless with linked list) - removed chkintr and hndlintr (use longquery_*) - removed longquery_timeout (use query_timeout) - renamed longquery_func to query_timeout_func - renamed longquery_param to query_timeout_param - queryStarttime to query_start_time - add a DSTR instance_name to TDSCONNECTION - add tds7_get_instance_port - removed tds_free_all_dynamic - tdsdump_append now static - new tds_process_tokens to replace removed - tds_process_result_tokens - tds_process_row_tokens - tds_process_row_tokens_ct - tds_process_trailing_tokens - removed tds_ctx_set_parent/tds_ctx_get_parent, use parent member - added void * parent argument to tds_alloc_context - tds_process_tokens return a TDS_CANCELLED if handle cancellation - removed query_timeout_func and query_timeout_param from TDSCONNECTION and TDSLOGIN - add tds_free_row - renamed TDSLOCALE->char_set to server_charset * 0.63 - ODBC: use tds_dstr* functions to store descriptor information - header privatizations (removing tds.h dependency). This is quite important for future binary compatibility. - ODBC: SQLFetch returns error correctly - ODBC: fix problem rebinding parameters - ODBC: ability to fetch data types after prepare (needed for Oracle bindings and OTL library). - Builds cleanly under OS X. - Improved BCP support for NULL fields and native file format. - ct-lib: ct_blk support (bcp for ct-lib). - ct-lib: Cursors! - apps: added bsqldb and defncopy. - iconv: better collation support, e.g. SQL_Scandinavian_CP850_CI_AS * 0.62 - ct-lib: cursor support - fixed PHP problem handling empty recordsets. See messages on ML: Damian Kramer, September 23, "Possible bug in freeTDS" Steve Hanselman, September 16 "Issue with freetds 0.61.2 ..." - ODBC: improved, best error report - ct-lib: support ct_diag (for Python) - ODBC: fixed SQLMoreResults/SQLRowCount and batch behavior - ODBC: fixes call to {?=store(?)} - ODBC: multiple record with "select id,name from sysobjects where name = 'sysobjects'" - ODBC: fixed early binding - ODBC: autodetect iODBC or unixODBC during configure - ODBC: implemented option 109 in SQLGetConnectOption (for OpenOffice) - freebcp understand \n as newline. Also \r and \0 (null byte). - added --without-libiconv configure option to switch off iconv library - ODBC: test and fixes for NUMERIC parameter - ODBC: dynamic query - SQLPutData - Sybase and blobs ported code for string building from ODBC to libtds - extended TDSSOCKET::iconv_info as an array. Keep converters for non-UCS-2 server charsets. Every TDSCOLINFO holding character data should point to one of these elements. - dblib: src/dblib/unittests/t0017.c (bcp) fixed - changed tds_get_char_data(), ML 2 May 2003, "tds_get_char_data and iconv". - rewrote tds_iconv: - use iconv() signature. - rely on TDSCOLINFO::iconv_info for conversion descriptor, instead of inferring it from the column sizes. - on read error, emit Msg 2403, Severity 16 (EX_INFO): "WARNING! Some character(s) could not be converted into client's character set. Unconverted bytes were changed to question marks ('?')." - on write error emit Msg 2402, Severity 16 (EX_USER): "Error converting client characters into server's character set. Some character(s) could not be converted." and return an error code. Do not proceed. - Cf. ML 16 Apr 2003. "conversion error management". - added doxygen to the nightly build - "make install" put the UG in PREFIX/share/doc/freetds/userguide - "make install" put doxygen html in PREFIX/share/doc/freetds/reference - moved website docs (not UG) to doc/htdoc, put in CVS - added bcp support to tds/dblib/ctlib. (started in dblib) - RPC stuff - added support for TDS 8.0 - TDS 7 Unicode to native charset conversion using iconv - autoconf the connection pooling stuff - DBLIB: output params - set database during login process - libtds: dynamic query - ctlib: null returns zero-length string (see "SELECT '' and TDS 7.0" in message list on 26 Jan 2003) * Jan 2003 - Version 0.61 - Dynamic SQL - Output parameters - Compute rows - Varbinary support - dsn-less ODBC connections - RPC support (db-lib) - Compatibility with DBD::Sybase 0.95 - 68 new functions! (see doc/api_status.txt) - Error/message handling rewritten, uses real error numbers - new sample programs - much cleaner code, warning-free compiles - namespace cleanup - public domain versions of functions for OSs that lack them - autoconf portability improvements - builds in HP-UX, Win32, and cygwin - No dependency on OpenSSL * Sep 2002 - Version 0.60 - Support for SQL Server 2000 datatypes and domain logins. - Support and convertibility of all major datatypes. - Much expanded coverage of the ODBC API. - An all-new BCP implementation, including host variable support. - Character set conversions, via the iconv library. - Threadsafe operation. * [late 2001?] - tdspool now working for big endian systems - Fixed mem leak in ctlib - Added some descriptive text to the PWD file - EINTR handling during login (Kostya Ivanov) - Added support for TLI style interfaces files (thanks Michael for explaining) - Added 'text size' config option which changes textsize on connect - Added preliminary TDS 8.0 support (no new datatypes supported though) - Added 'emulate little endian' config flag - Some TDS5 placeholder stuff. Not ready for primetime yet. - Fixed interfaces handling seg fault * Jul 2001 Brian Bruns - Version 0.52 - Mem leak fixes in dbloginfree() and tds_free_env() (John Dumas) - Added support for new configuration format (freetds.conf) - unixODBC now working - Fixed error in two's complement function for money types - Added support for nullable bits (BITN) - checked in work on tds connection pooling server - added preliminary userguide (James Lowden and me) - a lot of work on ODBC driver, now works with PHP - added config options for iodbc/unixodbc (unixODBC doesn't actually work yet) - image -> char now works (verified with ctlib only) - varbinary -> char now works with destlen of -1 - New config routines - Free socket on login fail - 64bit patches - off by one error - numeric problem with 7.0 fixed - digit cutoff on numerics/floats fixed * Nov 2000 Brian Bruns - Version 0.51 - removed all the old unittests from the samples directory - endian detection fixed - 'make check' and ctlib unittests (Mark) - TDS 7.0 fixes, numerics et al. (Scott) - dead connection handling (Geoff) - query timeout stuff (Jeff) * Dec 1999 Brian Bruns - Version 0.50 - Added TDS 7.0 support for MS SQL 7 - Added hostfile bulk copy for dblib - Added writetext support for dblib - Added CS_CON_STATUS property to ctlib - Fixed bugs for ctlib version of PHP 3/4 - Many changes to text/image handling - New script for running the unittests - dbcancel/ct_cancel now working properly - inserts/updates now return proper rowcount - Numerous bug fixes * Sep 1999 Brian Bruns - Version 0.47 - Added workaround for SQL 7.0 bug handling datetime/money for big endian (testing/bug report - Paul Schaap) - Added TDS 7.0 login function (untested) - Fixed many big endian bugs - Fixed some bus errors on Sparc - Fixed big endian detection - DBD::Sybase 0.19 now passes all tests - Fixed date bug working with PHP 3.x - binary/varbinary support added - Fixed Text datatypes in tds layer - More conversions implemented (Mark Schaal) - Fix make install for not overwriting interfaces (Michael Peppler) - CS_USERDATA now works - Numerous bug fixes (many people) * Thu Aug xx 1999 Brian Bruns - Version 0.46 - Fixed floating type support - Fixed lots of little datatype conversion bugs - Fixed 5.0 login acknowledgement bug - Message processing was cleaned up (Mark Schaal) - Fixed login bug for SQL Server 7.0 - DBD::Sybase 0.19 now compiles and partially works (very partially) - Fixed Solaris #define clash - Numerous bug fixes * Thu Jun 03 1999 Brian Bruns - Version 0.45 - Capabilities added to ctlib code - Numeric support working - MONEY to string conversions now support > 32 bit values - Fixed underread in message handling - Fixed various buffer overflow problems - Fixed NULL handling - Added support for length binding (copied arguement to ct_bind) - Converted ODBC to use iODBC driver manager - SQSH 1.7 runs - PHP 3.0.x with ctlib now runs * Thu Jan 14 1999 Brian Bruns - Version 0.41 - Better row buffering (Craig Spannring) - CT-Lib code improved greatly - Closer behaviour to real dblib - Commonized datatype conversions - Server side code is running somewhat. - SQSH 1.6 running - More ODBC functionality - Many bug fixes - Lots of other stuff I've already forgotten * Sun Nov 22 1998 Brian Bruns - Version 0.40 - Row buffering is now supported for dblib. - Better row handling (side effect of above) - Improved conversion code - Preliminary ODBC layer - PHP now runs basic scripts, maybe more - Many many bug fixes - General cleanup (better error handling, C++ friendly headers, etc...) * Fri Sep 04 1998 Mihai Ibanescu - Version 0.31 - By default the install dir is /usr/local/freetds - The Makefile in the samples dir is automatically built from Makefile.am. The samples dir is not installed, only packaged in the distribution. * Wed Sep 02 1998 Brian Bruns - Version 0.3 - Updated the AUTHORS file - FIXME Brian (added by misa) * Mon Aug 31 1998 Mihai Ibanescu - Version 0.21 - GNUified - Fixed a couple of the TODO issues: byte order is automatically determined, and the TDS version is a configurable option - Modified the README file to reflect the new directory structure Pre-GNUification log by Brian : 2/8/98 Should be able to send the first packet to a server soon, my output is only slightly different than open clients. This codes pretty crappy right now. I need to clean up alot of stuff, remove hardcode values, etc...but I'm anxious to see something work! 2/7/98 Broke the code up a bit, tds.c now handles all wire level stuff, dblib.c handles dblib specific stuff. So, in the future there can be ctlib.c and obdc.c can also sit on top of tds.c to handle the other CLIs 3/16/98 Been working on the code here and there...We can now send a query to the server, dbnumcols() and dbcolname() both work. Almost ready to get some data back. I put in a dummy dbbind to just handle strings so, I could do some work on dbnextrow(). However, we will have revisit almost everything later. 3/23/98 Haven't been able to work on it lately. Still trying to decide on the best way to propagate the row data from tds.c to dblib.c to the calling func. Not that hard, but nothing strikes me as the "Right Way" (tm). 4/2/98 Ok we are ready to release 0.01 (marked by the fact that a simple dblib program actually works!) 5/1/98 Haven't updated in quite a while. A few more dblib commands are supported. dbconvert() support is preliminary. Fixed alot of bugs. A little bit of cleanup. dbbind() sorta works now, needs work still. At least one mem leak that I know of (haven't gotten around to fixing it. Wish I had more time to work on it... 5/2/98 Decided to release what I have. executing sp_who seems to mostly work.. a step in the right direction. Version 0.02. Seem to have generated a little interest after mentioning it in a usenet post. 5/6/98 Can compile against sqsh!!! Did a reorg on tds.c, all dblib func that read data now go through tds_process_messages() which read the marker and calls other routines as necessary. sqsh's output is a little screwy (well I don't have a real dbprrow() yet, but the number of result sets coming back is too many). So, anyway Version 0.04 5/9/98 Decided to upload some new code, mostly just stubs. Sybperl compiles I can't get my perl to work with it. (I need to download perl and link statically, the one that comes on the system won't do). Anyway, most of dblib is present in stub form. 5/17/98 Managed to scrape up some time and release new code. Duplicate result sets went away, and handling of more datatypes (money, bit, more int stuff). Also, improved dbprhead()/row() function. 5/26/98 Ok, I'm doing the long overdue cleaning up of the code. All the kludges should be gone. Thanks, to everyone who contributed code/idea/corrections. 6/3/98 The majority of the overhaul is done...still some work to do, but this is much better than before. I'm bumping the version to 0.1 signifying that I actually use sqsh compiled against it on a regular basis. 6/5/98 TDS 4.2 support seems to be working properly 6/26/98 Gregg Jenson has added support for err and msg handling among other things. I've added some prelimary ctlib support (nothing working yet) 7/3/98 I think we are about ready to release 0.2. Gregg sent some datetime code which appears to work great. I added TDS 4.6 support (small changes really) and tested all the byte order issues on an RS/6000. Also, ctlib code will run the unittest.c and will compile all modules in sqsh 1.6, however there are many missing functions before it will link! 7/10/98 Haven't been able to work on it lately (moved this week). Anyway, trying to add some functions to server. 7/13/98 Tom Poindexter made some changes to get sybtcl to work. 8/8/98 Haven't had much time lately (again), however some small stuff has been fixed and the protocol version stuff has (mostly) been moved to a runtime option. sybperl is supposedly running for simple stuff. PK:iZ-&&)doc/freetds/ea-freetds-1.4.9/tds_ssl.htmlnu[ SSL and TDS

How to enable encryption on MSSQL

Under Linux (or any system that have openssl)

# create a file containing key and self-signed certificate
openssl req \
  -x509 -nodes -days 365 \
  -newkey rsa:1024 -keyout mycert.pem -out mycert.pem

# export mycert.pem as PKCS#12 file, mycert.pfx
openssl pkcs12 -export \
  -out mycert.pfx -in mycert.pem \
  -name "My Certificate"

So we created a mycert.pfx certificate ready to be imported

Under Windows

Open MMC and add certificates snap-in, add our certificate under personal and under ca root (to validate it)

Add to the registry the thumbprint of our certificato so to be used by mssql. For examples

REGEDIT4

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\SuperSocketNetLib]
"Certificate"=hex:DD,5F,6C,EE,47,8E,0C,C0,74,8B,C4,71,8D,87,1C,E6,07,20,F2,28

Restart MSSQL

Check event viewer for results

Encryption protocol

Prelogin packet (tds 7.1 only)

>From client to server

00000000  12 01 00 34 00 00 00 00  00 00 15 00 06 01 00 1b ...4.... ........
00000010  00 01 02 00 1c 00 0c 03  00 28 00 04 ff 08 00 01 ........ .(......
00000020  55 00 00 01 4d 53 53 51  4c 53 65 72 76 65 72 00 U...MSSQ LServer.
00000030  38 09 00 00                                      8...
HeaderDescriptionValue
00 00 15 00 06 netlib version (0) start from 0x15 length 0x06 8.341.0
01 00 1b 00 01 encrypt flag (1) start from 0x1b length 0x01 1, see below
02 00 1c 00 0c instance name (2) start from 0x1c length 0x0c "MSSQLServer\0" (as you note string is null terminated)
03 00 28 00 04 process id (3) start from 0x28 length 0x04 0x938 (why in little endian ??)
ff end  

Meaning of encryption flag (client):

  • 0x00 normal
  • 0x01 high encryption (128 bit ??)

MSSQL 2005 have 9.0.0 as a version and have a single byte option 4 (always seen as zero, I don't know the meaning).

>From server to client

00000000  04 01 00 25 00 00 01 00  00 00 15 00 06 01 00 1b ...%.... ........
00000010  00 01 02 00 1c 00 01 03  00 1d 00 00 ff 08 00 02 ........ ........
00000020  f8 00 00 01 00     

Similar
HeaderDescriptionValue
00 00 15 00 06 version (0) start from 0x15 length 0x06 8.0.760.0
01 00 1b 00 01 encrypt flag (1) start from 0x1b length 0x01 1, see below
02 00 1c 00 01 instance name (2) start from 0x1c length 0x01 "\0" (still null terminatted)
03 00 1d 00 00 process id (3) start from 0x1d length 0x0 no info
ff end  

Meaning of encryption flag (server):

  • 0x02, no certificate, no encryption required just do normal jobs (like FreeTDS)
  • 0x00, certificate, no force flag on server, prelogin to see certificate (TLS 1.0, not SSL 2 or 3 !!) login encrypted, after login do normal TDS (not encrypted)
  • 0x01, certificate, high encryption required by client prelogin to see certificate login encrypted, after login changed crypt (my client close connection perhaps a configuration problem...)
  • 0x03, certificate enabled, force encryption configured on server prelogin like 0x00, remains in SSL after login

Note that mssql2k unpatched do not set last packet flag (byte 2) for this packet.

Following a valid encrypted connection (0x00 from server, no force)

>From client to server

00000034  12 01 00 46 00 00 00 00  16 03 01 00 39 01 00 00 ...F.... ....9...
00000044  35 03 01 41 b9 5e 02 f8  7d 45 81 31 d9 73 9e 93 5..A.^.. }E.1.s..
00000054  91 b2 dd f4 4a 80 a3 92  a8 0f aa 67 32 8a 72 6d ....J... ...g2.rm
00000064  4b 22 07 00 00 0e 00 09  00 64 00 62 00 03 00 06 K"...... .d.b....
00000074  00 12 00 63 01 00                                ...c..

prelogin packet (0x12), content TLS 1.0 (you can see a ClientHell0, see RFC 2246)

>From server to client

00000025  04 01 03 da 00 00 01 00  16 03 01 03 cd 02 00 00 ........ ........
00000035  46 03 01 41 b9 5e 03 4b  c1 bf 9b a5 7d 83 74 57 F..A.^.K ....}.tW
00000045  00 03 de b5 fb fc 4d f8  84 15 ce 07 d9 ab fe 2b ......M. .......+
00000055  57 3c ad 20 96 10 00 00  6f 31 af e4 17 ae 2a 2b W<. .... o1....*+
00000065  37 29 0e 57 8a 4d 1d 32  aa d9 ed 62 6b 3d 3c d1 7).W.M.2 ...bk=<.
00000075  d1 c6 a9 cb 00 09 00 0b  00 03 7b 00 03 78 00 03 ........ ..{..x..
00000085  75 30 82 03 71 30 82 02  da a0 03 02 01 02 02 01 u0..q0.. ........
00000095  00 30 0d 06 09 2a 86 48  86 f7 0d 01 01 04 05 00 .0...*.H ........
000000A5  30 81 88 31 0b 30 09 06  03 55 04 06 13 02 49 54 0..1.0.. .U....IT
000000B5  31 10 30 0e 06 03 55 04  08 13 07 42 6f 6c 6f 67 1.0...U. ...Bolog
000000C5  6e 61 31 10 30 0e 06 03  55 04 07 13 07 42 6f 6c na1.0... U....Bol
... omissis...

normal reply packet (0x4), ServerHello(2), content TLS (certificate).

NOTE: if server send certificate request client (MS ODBC) crash so I think this is not supported.

>From client to server

0000007A  12 01 00 c6 00 00 00 00  16 03 01 00 86 10 00 00 ........ ........
0000008A  82 00 80 3a c6 96 ba 55  ce 8e 4b a4 e2 d7 b7 bd ...:...U ..K.....
0000009A  5d 5e f4 28 30 c6 c7 b9  4e 66 60 80 45 ce cb 4e ]^.(0... Nf`.E..N
000000AA  f6 f7 91 d7 9b 05 79 f8  ad f7 c7 13 77 36 cb 8c ......y. ....w6..
000000BA  04 58 33 3f 51 c8 0a bb  6a 95 8f 65 a1 e9 74 c5 .X3?Q... j..e..t.
000000CA  c9 c6 4a 11 b1 36 87 84  f2 96 82 d0 19 8a dd dc ..J..6.. ........
000000DA  d1 32 6a 32 ab 73 47 76  58 69 16 fd 9f 0b bd d7 .2j2.sGv Xi......
000000EA  72 79 a7 86 9a 71 2b 70  9a d1 8f e2 54 63 46 81 ry...q+p ....TcF.
000000FA  3e 6d 8a f7 8d 2e 26 02  3f 2d 0c a1 bc 63 ac 0a >m....&. ?-...c..
0000010A  8a 38 0e 14 03 01 00 01  01 16 03 01 00 28 12 09 .8...... .....(..
0000011A  d5 2d 93 8c 60 aa ae ec  e3 9b 2b 3c 27 63 46 ad .-..`... ..+<'cF.
0000012A  b1 b9 3d 1e 06 60 18 49  6d bb 76 80 8b 7b 51 70 ..=..`.I m.v..{Qp
0000013A  b7 79 14 b8 ba 62                                .y...b

prelogin (0x12), still TLS handshake, client_key_exchange (??) (0x16, 0x10), change crypt (0x14), handshake (crypted)

>From server to client

000003FF  04 01 00 3b 00 00 01 00  14 03 01 00 01 01 16 03 ...;.... ........
0000040F  01 00 28 96 3c 2e 41 42  09 d3 a8 77 82 19 7f 4b ..(.<.AB ...w...K
0000041F  ac 04 b8 96 4b f1 65 c2  35 9e ef 6a 1d c2 41 2d ....K.e. 5..j..A-
0000042F  a3 98 b8 2b 5c 0f 40 d1  98 b0 1e                ...+\.@. ...

normal reply (0x4), still TLS

0x14 means change crypt, followed by 0x16 (handshake crypted).

>From client to server

00000140  17 03 01 01 08 d7 3a b5  c3 fd a7 4d 14 b7 ce c7 ......:. ...M....
00000150  c6 6f f3 c5 03 1c 5c 86  7b 15 98 45 2a 93 73 c7 .o....\. {..E*.s.
00000160  72 75 72 23 c2 11 20 7d  5c b1 be e7 ac 72 ac b3 rur#.. } \....r..
00000170  47 41 4f 45 d8 fa 22 2b  94 b1 67 a5 7f de af 96 GAOE.."+ ..g.....
00000180  05 ad bb fc e4 33 66 3a  a2 f1 8d c5 5f 84 8b 38 .....3f: ...._..8
00000190  86 b0 df e8 87 e7 2c 26  e6 c0 66 2e b1 53 86 40 ......,& ..f..S.@
000001A0  98 0d 9e 2f 49 0b 17 b2  9d 55 d3 e3 7e 08 ca b9 .../I... .U..~...
000001B0  de 62 87 23 14 98 6e 10  d0 dd c2 94 70 4c 33 4b .b.#..n. ....pL3K
000001C0  09 8d b8 46 e5 a2 31 52  4d 89 06 b2 10 a8 ed b0 ...F..1R M.......
000001D0  a8 21 02 79 ab 99 de 67  28 a3 6c ea 18 88 b5 63 .!.y...g (.l....c
000001E0  02 ab f4 a1 78 0d 83 ec  b6 7b 61 7d 42 d2 38 bb ....x... .{a}B.8.
000001F0  50 fc e1 9e 1e e0 51 69  93 ea 05 9f d5 a4 a8 2b P.....Qi .......+
00000200  18 7f 79 4f 29 1a c0 35  3c 55 83 b0 9f af b7 de ..yO)..5 <U......
00000210  6d 2d 12 fa 27 ef 28 6b  a9 83 12 e6 a1 09 58 00 m-..'.(k ......X.
00000220  30 b3 3d f0 60 00 97 84  ee 28 b0 ae 31 78 50 d7 0.=.`... .(..1xP.
00000230  85 82 19 9f 57 ca a6 1c  d2 81 0f 6b 2d fb 47 41 ....W... ...k-.GA
00000240  37 58 8a ba 4f 38 f6 00  23 24 56 c2 35          7X..O8.. #$V.5

Well... you can note that this it's not a TDS packet !!! This is a fully crypted packet (login packet).

>From server to client

0000043A  04 01 01 79 00 33 01 00  e3 1b 00 01 06 6d 00 61 ...y.3.. .....m.a
0000044A  00 73 00 74 00 65 00 72  00 06 6d 00 61 00 73 00 .s.t.e.r ..m.a.s.
0000045A  74 00 65 00 72 00 ab 66  00 45 16 00 00 02 00 25 t.e.r..f .E.....%
0000046A  00 43 00 68 00 61 00 6e  00 67 00 65 00 64 00 20 .C.h.a.n .g.e.d. 
0000047A  00 64 00 61 00 74 00 61  00 62 00 61 00 73 00 65 .d.a.t.a .b.a.s.e
0000048A  00 20 00 63 00 6f 00 6e  00 74 00 65 00 78 00 74 . .c.o.n .t.e.x.t
0000049A  00 20 00 74 00 6f 00 20  00 27 00 6d 00 61 00 73 . .t.o.  .'.m.a.s
... omissis ...

Now normal data follow. In this case server used flag 0 (see above).

With force login (0x03 from server) after crypted login packet server and client continue to keep encrypting full packets

Note that uncrypted packets are still splitted using packet size selected during login (that is usually 4096 bytes). PK:iZq$doc/freetds/ea-freetds-1.4.9/TODO.mdnu[To Do List ========== This list is ordered top-to-bottom by priority. Things that are broken and need mending are at the top, followed by things that should work before the next release, followed by features that should be added/fixed/reworked (grouped by library). Everyone is encouraged to add to the list. Developers can do it directly; anyone else can post a patch to SourceForge. In this way we can communicate with each other about the project's priorities and needs. Must be fixed: ==== * ctlib parameters, handle all case even in tds7 * handle and test prepared query (? and @ syntax should be supported) * cancellation * ctlib seems to hang reading row while in IDLE state (tds_peek if not in pending state hang... update) Applied but could not test fix from ML 21 May 2008: "Problem with FreeTDS validating SQL commands (actually a ct_cancel() error)" I don't know if this is still true. Upper libraries should not use tds_peek as it does handle cancellation. Work in progress: ==== * be able to disable iconv for BCP (see Sybase documentation) I have a patch to disable it, how to handle NVARCHAR? -- freddy77 * BCP under ODBC. There is an experimental patch trying to implement it. For future versions (in priority order within library): All ---- * Cache protocol discovery (TDSVER=0.0). Save port/instance into some permanent storage. tsql should report progress in verbose mode. * retain values used from freetds.conf, so we can report them. * add a way for tsql to report host, port, and TDS version for the connection it's attempting. Actually libTDS does the name resolution in tds_connect and then just connect so there is no way for tsql to report these information. * move error message macro/prototype to tds.h.in; use in dblib.c. * conversion from ucs2 to utf8, provide for 2+ bytes/character * change numeric format to improve performance ?? * little/big endian based on platform * already packet at word * correctly aligned to read directly packetized * limit copy of data (now wire -> tds -> temp -> client) use a method like zero-copy In token.c getting row should write data even to client (callback, new user types, see ctlib conversion functions) In query.c writing data do the same (use additional column fields?) Situation is much improved in 0.95 version. In ODBC is much better as wire -> tds are never performed and convert extension to give client buffer is used if possible so to avoid the temp step. * review the way parameters are packed (too complicate, see ctlib bulk, cf "bulk copy and row buffer") * improve cursor support on dblib and ctlib * read on partial packet, do not wait entire one * detect if realloc accepts NULL pointers (in configure.ac) * support for password longer than 30 characters under Sybase (anybody know how ??) * under Sybase using prepared statements and BLOBs we shouldn't try to prepare every time (cache failure preparing, see odbc unittests logs, binary_test) done in ODBC ?? * Native bcp has no iconv support; character bcp files are assumed be encoded with the client's charset. More flexibility one both sides would be good. * date/time on Sybase (from 12.5) * encrypted connection for Sybase db-lib ---- * add DBTEXTLIMIT (dbsetopt), PHP require it to support textlimit ini value ct-lib ---- * dynamic placeholders (DBD::Sybase) * ct_option() calls (CS_OPT_ROWCOUNT, CS_OPT_TEXTSIZE, among others) * async function, async calls (dbpoll() and friends) * support all type of bind in ct_bind (CS_VARBINARY_TYPE and other) search "site:.sybase.com CS_VARBINARY ct_bind" on google for more info * complete sqlstate and other field in message (for Python) odbc ---- * SQLDescribeParam (Sybase seems to require it) A 100% success for DBD::ODBC require this. Require parsing of the string to extract placeholders ("?") type, something like "INSERT INTO test_table(field_a) VALUES(?)" -> "SELECT field_a FROM test_table(NOLOCK) WHERE 0=1" * Star Office complains that these TypeInfo constants are not implemented in SQLGetInfo: 47 SQL_USER_NAME (handle environment callbacks) do a "SELECT USER_NAME()". If data pending MS do another connection with same login. * SQLNativeSql and fill SQLGetInfo according (mssql7+ handle odbc escapes directly) * it seems that if statement it's wrong and we issue SQLPrepare on SQLExecute it try to send unprepared dynamic... state on dynamic?? * odbc array binding test large field (like image) have language queries some limits? do we have to split large multiple queries? * report error just before returning SQL_ERROR from inner function? * handle async flags ?? * handle no termination on odbc_set_string* Test and fix ---- * hidden fields (FOR BROWSE select, see flag test on tds) * what happen if we bind to an hidden field?? * if we use SQLGetData?? * if we request informations with SQLDescribeCol/SQLColAttribute(s)/ SQLGetDescField?? * as you noted returning # columns hidden fields are not counted (there is however a setting which is a mssql extension which threat hidden columns as normal) (cfr "SQLNumResultCols() is wrong (+1)" Jan 8 2008) * test: descriptors work * what happen to SQL_DESC_DATETIME_INTERVAL_CODE and SQL_DESC_CONCISE_TYPE changing only SQL_DESC_TYPE (with SQLSetDescField) * test: set SQL_C_DEFAULT and call SQLFetch (numeric, others) * test: SQLGetStmtAttr(SQL_ATTR_ROW_NUMBER) * all binded parameters * no bind and sqlgetdata * before first fetch * after last fetch pool ---- * get connection pooling working with all protocol versions * Make pool configuration a non-recompile process server ---- * Server API needs more work. It's in a quite ugly state. It's more experimental. Should be disabled by default to state it. PK:iZD[%doc/freetds/ea-freetds-1.4.9/tds.htmlnu[ TDS Protocol Documentation

TDS Protocol Documentation

This document attempts to cover the TDS protocol for:

TDS VersionSupported Products
4.2Sybase SQL Server < 10 and Microsoft SQL Server 6.5
5.0Sybase SQL Server >= 10
7.0Microsoft SQL Server 7.0
7.1Microsoft SQL Server 2000
7.2Microsoft SQL Server 2005

Contents

Common Terms

TDS protocol versions
  TDS 5.0    tds version 5.0
  TDS 7.0    tds version 7.0
  TDS 7.0+   tds version 7.0, 7.1 and 7.2
  TDS 5.0-   tds version 5.0 and previous

Variable types used in this document:
  CHAR      8-bit char
    CHAR[6]	string of 6 chars
    CHAR[n]     variable length string
  XCHAR    single byte (TDS 5.0-) or ucs2le (TDS 7.0+) characters
  INT8      8-bit int
  INT16    16-bit int
  INT32    32-bit int
  UCS2LE   Unicode in UCS2LE format

Note: FreeTDS uses TDS_TINYINT for INT8 and TDS_SMALLINT for INT16.

Typical Usage sequences

These are TDS 4.2 and not meant to be 100% correct, but I thought they might be helpful to get an overall view of what goes on.

--> Login
<-- Login acknowledgement

--> INSERT SQL statement
<-- Result Set Done

--> SELECT SQL statement
<-- Column Names
<-- Column Info
<-- Row Result
<-- Row Result
<-- Result Set Done

--> call stored procedure
<-- Column Names
<-- Column Info
<-- Row Result
<-- Row Result
<-- Done Inside Process
<-- Column Names
<-- Column Info
<-- Row Result
<-- Row Result
<-- Done Inside Process
<-- Return Status
<-- Process Done

The packet format

Every informations in TDS protocol (query, RPCs, responses and so on) is splitted in packets.

All packets start with the following 8 byte header.

 INT8       INT8          INT16      4 bytes
+----------+-------------+----------+--------------------+
|  packet  | last packet |  packet  |    unknown         |
|   type   |  indicator  |   size   |                    |
+----------+-------------+----------+--------------------+

Fields:
packet type 
     0x01 TDS 4.2 or 7.0 query
     0x02 TDS 4.2 or 5.0 login packet
     0x03 RPC
     0x04 responses from server
     0x06 cancels
     0x07 Used in Bulk Copy
     0x0F TDS 5.0 query
     0x10 TDS 7.0 login packet
     0x11 TDS 7.0 authentication packet
     0x12 TDS 8 prelogin packet
last packet indicator 
     0x00 if more packets
     0x01 if last packet
packet size
     (in network byte order)
unknown?
     always 0x00
     this has something to do with server to server communication/rpc stuff

The remainder of the packet depends on the type of information it is providing. As noted above, packets break down into the types query, login, response, and cancels. Response packets are further split into multiple sub-types denoted by the first byte (a.k.a. the token) following the above header.

Note: A TDS packet that is longer than 512 bytes is split on the 512 byte boundary and the "more packets" bit is set. The full TDS packet is reassembled from its component 512 byte packets with the 8-byte headers stripped out. 512 is the block_size in the login packet, so it could be set to a different values. In Sybase you can configure a range of valid block sizes. TDS 7.0+ use a default of 4096 as block size.


TDS 4.2 & 5.0 Login Packet

Packet type (first byte) is 2. The numbers on the left are decimal offsets including the 8 byte packet header.

byte   var type    description
------------------------------
   8   CHAR[30]    host_name
  38   INT8        host_name_length
  39   CHAR[30]    user_name
  69   INT8        user_name_length
  70   CHAR[30]    password
 100   INT8        password_length
 101   CHAR[30]    host_process
 131   INT8        host_process_length
 132   ?           magic1[6]          /* mystery stuff */
 138   INT8        bulk_copy 
 139   ?           magic2[9]          /* mystery stuff */
 148   CHAR[30]    app_name
 178   INT8        app_name_length
 179   CHAR[30]    server_name
 209   INT8        server_name_length
 210   ?           magic3[1]          /* 0, don't know this one either */
 211   INT8        password2_length
 212   CHAR[30]    password2
 242   CHAR[223]   magic4
 465   INT8        password2_length_plus2
 466   INT16       major_version      /* TDS version */
 468   INT16       minor_version      /* TDS version */
 470   CHAR        library_name[10]   /* "Ct-Library" or "DB-Library" */
 480   INT8        library_length
 481   INT16       major_version2     /* program version */
 483   INT16       minor_version2     /* program version */
 485   ?           magic6[3]          /* ? last two octets are 13 and 17 */
                                      /* bdw reports last two as 12 and 16 here  */
                                      /* possibly a bitset flag  */
 488   CHAR[30]    language           /* e.g. "us-english" */
 518   INT8        language_length
 519   ?           magic7[1]          /*  mystery stuff */
 520   INT16       old_secure         /* explanation? */
 522   INT8        encrypted          /*  1 means encrypted all password fields blank */
 523   ?           magic8[1]          /*  no clue... zeros */
 524   CHAR        sec_spare[9]       /* explanation? */
 533   CHAR[30]    char_set           /* e.g. "iso_1" */
 563   INT8        char_set_length
 564   INT8        magic9[1]          /* 1 */ 
 565   CHAR[6]     block_size         /*  in text */
 571   INT8        block_size_length 
 572   ?           magic10[25]        /* lots of stuff here...no clue */

Any help with the magic numbers would be most appreciated.


TDS 7.0+ Login Packet

byte  var type  description
---------------------------
  0   INT32	total packet size
  4   INT8[4]	TDS Version	
                	0x00000070 7.0
			0x01000071 7.1
                	0x02000972 7.2 (7.2.9?)
  8   INT32	packet size (default 4096)
 12   INT8[4]	client program version
 16   INT32	PID of client
 20   INT32	connection id (usually 0)
 24   INT8	option flags 1
                0x80 enable warning messages if SET LANGUAGE issued
                0x40 change to initial database must succeed
                0x20 enable warning messages if USE <database> issued
                0x10 enable BCP
		0x08 use ND5000 floating point format (untested)
		0x04 use VAX floating point format (untested)
		0x02 use EBCDIC encoding (untested)
		0x01 use big-endian byte order (untested)
 25   INT8	option flags 2
                0x80 enable domain login security
		0x40 "USER_SERVER - reserved" 
		0x20 user type is "DQ login"
		0x10 user type is "replication login"
		0x08 "fCacheConnect"
		0x04 "fTranBoundary"
                0x02 client is an ODBC driver
                0x01 change to initial language must succeed
 26   INT8	0x04 spawn user instance (TDS 7.2)
                0x02 XML data type instances are returned as binary XML (TDS 7.2)
                0x01 password change requested (TDS 7.2)
 27   INT8	0x01 SQL Type: 0 = use default, 1 = use T-SQL (TDS 7.2)
 28   INT8[4]	time zone (0x88ffffff ???)
 32   INT8[4]	collation information
 36   INT16	position of client hostname (86)
 38   INT16	hostname length
 40   INT16	position of username
 42   INT16	username length
 44   INT16	position of password
 46   INT16	password length
 48   INT16	position of app name
 50   INT16	app name length
 52   INT16	position of server name
 54   INT16	server name length
 56   INT16	position of remote server/password pairs
 58   INT16	remote server/password pairs length
 60   INT16	position of library name
 62   INT16	library name length
 64   INT16	position of language
 66   INT16	language name (for italian "Italiano", coded UCS2)
 68   INT16	position of database name
 70   INT16	database name length
 72   INT8[6]	MAC address of client
 78   INT16	position of auth portion
 80   INT16	NT authentication length
 82   INT16	next position (same as total packet size)
 84   INT16	0
 86   UCS2LE[n] hostname
      UCS2LE[n]	username
      UCS2LE[n]	encrypted password
      UCS2LE[n]	app name
      UCS2LE[n]	server name
      UCS2LE[n]	library name
      UCS2LE[n]	language name
      UCS2LE[n]	database name
      NT Authentication packet

NT Authentication packet
  0   CHAR[8]	authentication id "NTLMSSP\0"
  8   INT32     1  message type
 12   INT32	0xb201 flags
 16   INT16	domain length
 18   INT16     domain length
 20   INT32     domain offset
 24   INT16     hostname length
 26   INT16     hostname length
 28   INT32     hostname offset
 32   CHAR[n]   hostname
      CHAR[n]   domain
See documentation on Samba for detail (or search ntlm authentication for IIS)

For mssql 2005 before hostname (byte 86) you have
 86   INT16     next position,  or 
                position of file name for a database to be 
                attached during the connection process
 88   INT16     database filename length
 90   INT16     new password position
 92   INT16     new password length
 94   UCS2LE[n] hostname
      ... (as above)

"current pos" is the starting byte address for a Unicode string within the packet. The length of that Unicode string immediately follows. That implies there are at least 2 more strings that could be defined. (character set??)

Username and password are empty if domain authentication is used.

If the client uses an authentication packet, the server replies with an Authentication token followed by an Authentication packet.


TDS 7.0 Authentication Packet

 varies
+------+
| auth |
+------+

auth   authentication data
       for NTLM this message 3

This packet usually follows Authentication token.


Types

HEXDECtypeprotocolnullablesizecollate
0x1F31SYBVOID7+no0
0x2234SYBIMAGEyes4
0x2335SYBTEXTyes4yes
0x2436SYBUNIQUE7+yes1
0x2537SYBVARBINARYyes1
0x2638SYBINTNyes1
0x2739SYBVARCHARyes1
0x2D45SYBBINARYyes1
0x2F47SYBCHARyes1
0x3048SYBINT1no0
0x3250SYBBITno0
0x3452SYBINT2no0
0x3856SYBINT4no0
0x3A58SYBDATETIME4no0
0x3B59SYBREALno0
0x3C60SYBMONEYno0
0x3D61SYBDATETIMEno0
0x3E62SYBFLT8no0
0x4064SYBSINT15no0
0x4165SYBUINT25no0
0x4266SYBUINT45no0
0x4367SYBUINT85no0
0x6298SYBVARIANT7+yes4
0x6399SYBNTEXT7+yes4yes
0x67103SYBNVARCHAR7+yes1
0x68104SYBBITNyes1
0x6A106SYBDECIMALyes1
0x6C108SYBNUMERICyes1
0x6D109SYBFLTNyes1
0x6E110SYBMONEYNyes1
0x6F111SYBDATETIMNyes1
0x7A122SYBMONEY4no0
0x7F127SYBINT8no0
0xA5165XSYBVARBINARY7+yes2 *
0xA7167XSYBVARCHAR7+yes2 *yes
0xAD173XSYBBINARY7+yes2
0xAF175XSYBCHAR7+yes2yes
0xE1225SYBLONGBINARY5yes4
0xE7231XSYBNVARCHAR7+yes2 *yes
0xEF239XSYBNCHAR7+yes2yes

* Under TDS 7.2+ these types allow size to be -1, representing varchar(max), varbinary(max) and nvarchar(max). Data representation for them changes:

  • size is 64 (not 16) bits
  • size of -1 means NULL
  • size of -2 means the size is unknown
  • the data are split in chunks, where each chunk starts with a 32-bit size
  • a chunk with size <= 0 is the terminal chunk

Collation type - TDS 7.1

The collation structure contains information about the character set encoding and comparison method.

 INT16      INT16    INT8
+----------+--------+------------+
| codepage | flags  | charset_id |
+----------+--------+------------+

codepage    windows codepage (see http://www.microsoft.com/globaldev/nlsweb/)
            also specified in lcid column of master..syslanguages
flags       sort flags
            0x100 binary compare
            0x080 width insensitive
            0x040 Katatype insensitive
            0x020 accent insensitive
            0x010 case insensitive
            If binary flag is specified other flags are not present
            Low nibble of flags is a charset specifier (like chinese dialect)
charset_id  charset id in master..syscharsets table or zero for no SQL collations

Collations names can be obtained from select name from ::fn_helpcollations() query


Column Metadata

 INT8          XCHAR[n]       INT8    INT32   INT8
+-------------+--------------+-------+-------+---------+
| column name | column name  | flags |  user | column  |
|   length    |              |       |  type |  type   |
+-------------+--------------+-------+-------+---------+

 varies        INT8       INT8       INT16      XCHAR[n]     INT8     varies
+-------------+----------+----------+----------+------------+--------+--------+
| column size |precision |  scale   | t length | table name | locale | locale |
|             |          |          |          |            | length |  info  |
| (optional)  |(optional)|(optional)|(optional)| (optional) | (opt)  | (opt)  |
+-------------+----------+----------+----------+------------+--------+--------+

column name length 
column name        column name in result set, not necessarily db column name
flags              bit flags
                   0x1  hidden (TDS 5.0)
                   0x2  key
                   0x10 writable
                   0x20 can be NULL
                   0x40 identity
user type          usertype column from syscolumns
column type        column type
column size        not present for fixed size columns
precision          present only for SYBDECIMAL and SYBNUMERIC
scale              present only for SYBDECIMAL and SYBNUMERIC
t length           present only for SYBTEXT and SYBIMAGE, length of table name
table name         present only for SYBTEXT and SYBIMAGE
locale length      length of locale info (in bytes)
                   only for TDS 5.0 results (not for parameters)
locale info        unknown
                   only for TDS 5.0 results (not for parameters)

Client request

Normal tokens (contained in packets 0xF)

TODO

Special packets


Language packet (0x1 1)

This sample packet contain just SQL commands. It's supported by all TDS version (although TDS 5.0 have others token with similar use)

  XCHAR[n]
+---------+
| string  |
+---------+

string   SQL text

RPC packet (0x3 3)

Do not confuse an RPC packet with an RPC token. The RPC packet is supported by all version of TDS; the RPC token is supported only by TDS 5.0 (and has different format). This is the oldest (and the only one in mssql) way to call directly an RPC. Sybase also documents it, but as 0xE.

  INT16         XCHAR[n]   INT16  
+-------------+----------+-------+----------+
| name length | rpc name | flags | params   |
+-------------+----------+-------+----------+

name length   length of RPC name in characters. 
              mssql2k+ support some core RPC using numbers
              If a number is used instead of name name length is marked as -1
              (null) and a INT16 is used for the name.
                0x1  1  sp_cursor
                0x2  2  sp_cursoropen
                0x3  3  sp_cursorprepare
                0x4  4  sp_cursorexecute
                0x5  5  sp_cursorprepexec
                0x6  6  sp_cursorunprepare
                0x7  7  sp_cursorfetch
                0x8  8  sp_cursoroption
                0x9  9  sp_cursorclose
                0xA  10 sp_executesql
                0xB  11 sp_prepare
                0xC  12 sp_execute ???
                0xD  13 sp_prepexec
                0xE  14 sp_prepexecrpc
                0xF  15 sp_unprepare
              sp_execute seems to have some problems, even MS ODBC use name
              version instead of number.
rpc name      name of RPC.
flags         bit flags. 
               0x1 1 recompile procedure (TDS 7.0+/TDS 5.0)
               0x2 2 no metadata (TDS 7.0+)
                     (I don't know meaning of "no metadata" -- freddy77)
params        parameters. See below

Every parameter has the following structure

+-----------+------+
| data info | data |
+-----------+------+
data info    data information. See below
data         data. See results for detail

Data info structure

  INT8          XCHAR[n]     INT8    INT32
+-------------+------------+-------+--------------------+
| name length | param name | flags | usertype (TDS 5.0) |
+-------------+------------+-------+--------------------+
  INT8   varies  varies     INT8[5]         INT8
+------+-------+----------+---------------+------------------+
| type | size  | optional | collate       | locale           |
|      | (opt) | (opt)    | info(TDS 7.1) | length (TDS 5.0) |
+------+-------+----------+---------------+------------------+

name length   parameter name length (0 if unused)
param name    parameter name
flags         bit Name           Meaning
              0x1 TDS_RPC_OUTPUT output parameter
              0x2 TDS_RPC_NODEF  output parameter has no default value. 
                                 Valid only with TDS_RPC_OUTPUT.

usertype      usertype
type          param type
size          see Results
optional      see Results. Blobs DO NOT have 
              optional on input parameters (output blob parameters
              are not supported by any version of TDS).
collate info  only for type that want collate info and using TDS 7.1
locale length locale information length. Usually 0 (if not locale
              information follow, the structure is unknown)

Chained RPCs

Under TDS 7.0+ is possible to chain multiple RPCs together. This is useful to limit packets and round-trips with server. RPCs can be chained using byte 0x80 (TDS 7.0/TDS 7.1) or 0xFF (TDS 7.2).

       INT8                     INT8
+-----+------------------------+----------------+-----+
| RPC | 0x80 (TDS 7.0/TDS 7.1) | 0xFF (TDS 7.2) | RPC | ...
+-----+------------------------+----------------+-----+

Bulk Copy packet (0x7 7)

This documents a TDS 5.0 packet. It might be true for others....

BCP Packet Structure

 INT8       INT16          INT32                
+----------+-------------+--------------------+
|  packet  | last packet |  packet            |
| type = 7 |  indicator  |   size             |
+----------+-------------+--------------------+

		followed by N row buffers, 
		where N is computed by exhausting the packet size

BCP Packet Row Buffer

 INT16          INT8       INT8	      INT16	    
+--------------+----------+----------+--------------+
| size         |  ncols   |  zero    | size (again) |
+--------------+----------+----------+--------------+

	followed by column buffers (data), where 
		
		first, the fixed-size datatype columns

		 fixed size and count (determined by column definition)
		+--------------+
		|    data .... | [repeats once for each mandatory column]
		+--------------+

		then, the variable-size (including nullable) datatype columns

		 variable size and count
		+--------------+
		|    data .... | [repeats ncol times]
		+--------------+

		followed by two tables (!) to describe the column buffers

 Adjustment Table (optional)
 
 INT8       INT8        
+----------+----------+
| 1 + ncols| offset   | [repeats ncol + 1 times]
+----------+----------+

 Offset Table (mandatory)
 
 INT8       INT8        
+----------+----------+
| 1 + ncols| offset   | [repeats ncol + 1 times]
+----------+----------+

The BCP packet has a slightly different Packet header!?

Computation of Offset and Adjustment tables

The offset and adjustment tables describe the postion of the first byte of each variable-size column. The first element holds the count of elements in the offset/adjustment table. Thereafer, the offsets are arranged in reverse order: the last element — which is also the last byte of the row buffer — holds the offset from the start of the row of the first variable-size column. The next-to-last offset table element holds the starting position of the second variable-size column, and so on.

Offset Table Example

  1. 5
  2. 31
  3. 22
  4. 21
  5. 8
  6. 4

The first element is 5 because there are five elements in the list. There are 4 column data buffers with 5 endpoints. The first column's data begins at offset 4. Computations:

column 1
offset 4
length: 4 = 8 - 4
column 2
offset 8
length: 13 = 21 - 8
column 3
offset 21
length: 1 = 22 - 21
column 4
offset 22
length: 9 = 31 - 22

Any column not accounted for is implicitly NULL. To represent a NULL column between two dataful columns, the offset table will have adjacent entries of the same value.

Adjustment table

The so-called adjustment table provides for longer rows. The reader will note the Offset table has 8-bit elements, which would limit the width of the table: the last variable column would have to end less than 256 bytes from the start fo the row. Rather than changing the definition of the Offset table, a second table, the Adjustment table, was introduced. It holds high-order bytes for the column offsets.

In other words, to compute a variable column's offset from the start of the row buffer, the server looks up its offset table value, then consults the same position in the adjustment table, and splices them together.

Offset table commentary

The BCP packet is very dense. The data formats are governed by the table definition. Non-NULL columns of course must be present; there is no need to count them or compute their size. The NULL columns are undelimited; their boundaries are defined by the minimalist offset table.

The Adjustment table seems silly at first glance. Why not just make the offset table's elements 16 or or even 32 bits? The reason is overhead. Most rows will have less than 256 bytes of variable column data. By using the adjustment table, the BCP packet avoids adding one or even three empty bytes per column per row.

Why is the table in reverse order? Because that places the first offset at a known location: the end of each row gives the start of the first column. The server can work its way down the offset table and compute the column sizes. If they don't add up — if there are data between the (presumed) end of the last column and the start of the offset table — the server knows it should look for an adjustment table. Because the scheme is infinitely repeatable, rows could one day grow to terabyte widths without redefining the packet structure.


Server Responses

Responses from the server start with a single octet (token) identifying its type. If variable length, they generally have the length as the second and third bytes

Tokens encountered thus far:
HEXDECnamenote
0x2032Param Format 25.0 only
0x2133Language5.0 only, client-side
0x2234OrderBy 25.0 only??
0x6197Row Format 25.0 only
0x71113"Logout"5.0? ct_close(), client-side?
0x79121Return Status 
0x7C124Process ID4.2 only
0x80128Cursor Close5.0 only
0x81129Cursor Delete5.0 only
0x811297.0 Result7.0 only
0x82130Cursor Fetch5.0 only
0x83131Cursor Info5.0 only
0x84132Cursor Open5.0 only
0x86134Cursor Declare5.0 only
0x881367.0 Compute Result7.0 only
0xA0160Column Name4.2 only
0xA1161Column Format4.2 only
0xA3163Dynamic 25.0 only
0xA4164Table namesname of tables in a FOR BROWSE select
0xA5165Column Infocolumn information in a FOR BROWSE select
0xA6166Option Cmd5.0 only
0xA7167Compute Names 
0xA8168Compute Result 
0xA9169Order By 
0xAA170Error Message 
0xAB171Info Message 
0xAC172Output Parameters 
0xAD173Login Acknowledgement 
0xAE174Control 
0xD1209Data --- Row Result 
0xD3211Data --- Compute Result 
0xD7215Params5.0 only
0xE2226Capability5.0 only. Information on server
0xE3227Environment Change(database change, packet size, etc...)
0xE5229Extended Error Message 
0xE6230DBRPC5.0 only RPC calls
0xE7231Dynamic5.0 only
0xEC236Param Format5.0 only
0xED237Authentication7.0 only
0xEE238Result Set5.0 only
0xFD253Result Set Done 
0xFE254Process Done 
0xFF255Done inside Process 

Param Format 2 - TDS 5.0 (0x20 32)

TODO.  


Language - TDS 5.0 (0x21 33)

 INT32    INT8     CHAR[n]
+--------+--------+-------+
| length | status | query |
+--------+--------+-------+

length  total token length
status  0 no args
        1 has args (followed by PARAMFMT/PARAMS)
query   query (total length - 1)

Order By 2 (0x22 34)

TODO.  


Row Format 2 - TDS 5.0 (0x61 97)

TODO.  


"Logout" (0x71 113)

No information. (1 byte, value=0 ?)  


Return Status (0x79 121)

 INT32
+---------------+
| Return status |
+---------------+

The return value of a stored procedure.  

Process ID (0x7C 124)


 8 bytes
+----------------+
| process number |
+----------------+

Presumably the process ID number for an executing stored procedure. (I'm not sure how this would ever be used by a client. *mjs*)  


Cursor Close - TDS 5.0 (0x80 128)

TODO.  


Cursor Delete - TDS 5.0 (0x81 129)

TODO.  


Result - TDS 7.0+ (0x81 129)

 INT16  
+----------+-------------+
| #columns | column_info | 
+----------+-------------+

The TDS 7.0 column_info is formatted as follows for each column:

 INT16      INT16   INT8   varies  varies     INT8[5]         INT8          UCS2LE[n]
+----------+-------+------+-------+----------+---------------+-------------+---------+
| usertype | flags | type | size  | optional | collate       | name length | name    | 
|          |       |      | (opt) | (opt)    | info(TDS 7.1) |             |         |
+----------+-------+------+-------+----------+---------------+-------------+---------+

usertype	type modifier
flags		bit flags
		0x1  can be NULL
		0x8  can be written (it's not an expression)
		0x10 identity 
type		data type, values >128 indicate a large type
size		none for fixed size types
		4 bytes for blob and text
		2 bytes for large types
		1 byte for all others
optional
                               INT8        INT8
                              +-----------+-------+
  numeric/decimal types:      | precision | scale |
                              +-----------+-------+

                               INT16               UCS2LE[n]
                              +-------------------+------------+
  blob/text types:            | table name length | table name |
                              +-------------------+------------+

  collate info are available only using TDS 7.1 and for characters types (but not
  for old type like short VARCHAR, only 2byte length versions)

Cursor Fetch - TDS 5.0 (0x82 130)

TODO.

Cursor Info - TDS 5.0 (0x83 131)

TODO.

Cursor Open - TDS 5.0 (0x84 132)

TODO.

Cursor Declare - TDS 5.0 (0x86 134)

TODO.

Compute Result - TDS 7.0+ (0x88 136)

TODO.

Column Name (0xA0 160)

 INT16          INT8      CHAR[n]               INT8      CHAR[n] 
+--------------+---------+--------------+------+---------+--------------+
| total length | length1 | column1 name | .... | lengthN | columnN name |
+--------------+---------+--------------+------+---------+--------------+

This token is the first token that contain result informations. Is usually followed by Column Format token (0xA1 161)


Column Format (0xA1 161)

 INT16  
+--------------+-------------+
| total length | column_info | 
+--------------+-------------+

The number of columns is the same of previous Column Name token.

The TDS 4.2 column_info is formatted as follows for each column:

 INT8[4]     INT8   varies  varies
+-----------+------+-------+----------+
| usertype/ | type | size  | optional |
|   flags   |      | (opt) | (opt)    |
+-----------+------+-------+----------+

usertype/flags for Sybase

   INT32
  +----------+
  | usertype |
  +----------+

usertype/flags for MSSQL

   INT16
  +----------+-------+
  | usertype | flags |
  +----------+-------+

usertype	type modifier
flags		bit flags (only MSSQL)
		0x1  can be NULL
		0x8  can be written (it's not an expression)
		0x10 identity 
type		data type
size		none for fixed size types
		4 bytes for blob and text
		1 byte for all others
                (TDS 4.2 do not support large types)
optional
                               INT8        INT8
                              +-----------+-------+
  numeric/decimal types:      | precision | scale |
  (supported??)               +-----------+-------+

                               INT16               CHAR[n]
                              +-------------------+------------+
  blob/text types:            | table name length | table name |
                              +-------------------+------------+

Dynamic 2 - TDS 5.0 (0xA3 163)

TODO.

Option Cmd - TDS 5.0 (0xA6 166)

TODO.

Compute Result (0xA8 168)

 INT16          INT16        INT8       varies        INT8      INT8[n]
+--------------+------------+----------+-------------+---------+-------+
| total length | compute id | #columns | column info | #bycols | bycol |
+--------------+------------+----------+-------------+---------+-------+

column info:

 INT8       INT8      INT32      INT8     varies  INT8               varies
+----------+---------+----------+--------+-------+------------------+----------------+
| operator | operand | usertype | column | size  | locale length    | locale info    |
|          |         |          |  type  | (opt) |  info (TDS 5.0)  | (TDS 5.0)      |
+----------+---------+----------+--------+-------+------------------+----------------+

operator      operator
              0x4b COUNT
              0x4c UNSIGNED? COUNT
              0x4d SUM
              0x4e UNSIGNED? SUM
              0x4f AVG
              0x50 UNSIGNED? AVG
              0x51 MIN
              0x52 MAX
              0x09 COUNT_BIG (mssql2k)
              0x30 STDEV (mssql2k)
              0x31 STDEVP (mssql2k)
              0x32 VAR (mssql2k)
              0x33 VARP (mssql2k)
              0x72 CHECKSUM_AGG (mssql2k)
operand       ???
usertype      usertype
column type   data type
size          data size
locale length length of locale informations
locale info   locale informations (unknown)

Each bycol information contains column info for a specific column.

TODO: optional possible?? collate infos ??

TabName (0xA4 164)

TDS4/5/7:

 INT16          INT16         XCHAR[n]
+--------------+-------------+------------+
| total length | name length | table name | ...
+--------------+-------------+------------+

name length   table name length
table name    table name

TDS 7.1:

 INT16          varies
+--------------+-------------+
| total length | table names |
+--------------+-------------+

table name:
 INT8              INT16              XCHAR[n]
+-----------------+------------------+----------------+
| # of components | component length | component name |
+-----------------+------------------+----------------+

ie:
  name        -> 01  04 00  ucs2le "name"
  db..name    -> 03  02 00  ucs2le "db"  00 00  04 00  ucs2le "name"
  db.dbo.name -> 03  02 00  ucs2le "db"  03 00  ucs2le "dbo"  04 00  ucs2le "name"

Column Info (0xA5 165)

 INT16          varies
+--------------+--------------+
| total length | column infos |
+--------------+--------------+

column info:

 INT8    INT8          INT8    INT8          XCHAR[n]
+-------+-------------+-------+-------------+-------------+
| index | table index | flags | name length | column name |
|       |             |       |  (opt)      |  (opt)      |
+-------+-------------+-------+-------------+-------------+

index        index in result format (1-based)
table index  index in previous TabName (1-based)
             0 means no table (ie computed)
flags        set of flags
             0x04 expression
             0x08 key
             0x10 hidden
             0x20 column name present
name length  length of following column
column name  real column name (result contain the label)

This token follow TabName token    


compute "control" ? (0xA7 167)

"control" (0xAE 174)

Miscellaneous note (from *bdw* ?) found with 0xAE:

  has one byte for each column, 
  comes between result(238) and first row(209),
  I believe computed column info is stored here, need to investigate

Order By (0xA9 169)

 INT16    variable (1 byte per col)
+--------+---------+
| length | orders  |
+--------+---------+

length		Length of packet(and number of cols)
orders          one byte per order by indicating the
                column # in the output matching the
                order from Column Info and Column Names
                and data in following Row Data items.
                A 0 indicates the column is not in the
                resulting rows.

an example:
select first_name, last_name, number from employee
order by salary, number
assuming the columns are returned in the order
queried:
first_name then last_name, then number. we would have:
----------------
|  2   | 0 | 3 |
----------------
where length = 2 then the orders evaluate:
0 for salary, meaning there is no salary data returned
3 for number, meaning the 3rd data item corresponding
to a column is the number

 


Error Message (0xAA 170)

Non-error Message (0xAB 171)

Extended Error Message (0xE5 229)

 INT16    INT32        INT8    INT8    
+--------+------------+-------+-------+
| length | msg number | state | level |
+--------+------------+-------+-------+

 INT16      XCHAR[n]  INT8       XCHAR[n]  INT8       XCHAR[n]  INT16             INT32
+----------+---------+----------+---------+----------+---------+-----------------+-----------------+
| m length | message | s length | server  | p length | process | line#(TDS 7.1-) | line# (TDS 7.2) |
+----------+---------+----------+---------+----------+---------+-----------------+-----------------+

length		Length of packet
msg number	SQL message number
state		?
level		An error if level > 10, a message if level <= 10
m length	Length of message
message		Text of error/message
s length	Length of server name
server		Name of "server" ?
p length	Length of process name
process name	Stored procedure name, if any
line#		Line number of input which generated the message

Output Parameters (0xAC 172)

  Output parameters of a stored procedure.

 INT16    INT8       XCHAR[n]  INT8    INT32      INT8
+--------+----------+---------+-------+----------+----------+------+
| length | c length | colname | flags | usertype | datatype | .... | 
+--------+----------+---------+-------+----------+----------+------+

length		Length of packet
c length	Length of colname
colname		Name of column
flags		0x1 Nullable
usertype	cf. systypes table in database
datatype	Type of data returned

The trailing information depends on whether the datatype is
a fixed size datatype.
				 N bytes
				+---------+
  Datatype of fixed size N	| data    |
				+---------+

				 INT8          INT8            N bytes
				+-------------+---------------+--------+
  Otherwise			| column size | actual size N | data   |
				+-------------+---------------+--------+

Login Acknowledgement (0xAD 173)

 INT16    INT8    4 bytes   INT8       XCHAR[n] 4 bytes
+--------+-------+---------+----------+--------+----------+
| length |  ack  | version | t length |  text  | ser_ver  |
+--------+-------+---------+----------+--------+----------+

length		length of packet
ack		0x01 success	4.2
		0x05 success	5.0
		0x06 failure	5.0
version		TDS version 4 bytes:  major.minor.?.?
t length	length of text
text		server name (ie 'Microsoft SQL Server')
ser_ver		Server version
		(with strange encoding, differring from TDS version)

   


Data - Row Result (0xD1 209)

Data - Compute Result (0xD3 211)

 INT8       variable size
+----------+--------------------+
|  token   |   row data         |
+----------+--------------------+

Row data starts with one byte (decimal 209), for variable length types, a one byte length field precedes the data, for fixed length records just the data appears.
Note: nullable integers and floats are variable length.

For example: sp_who

The first field is spid, a smallint
The second field is status a char(12), in our example "recv sleep "

The row would look like this:

  byte  0 is the token
  bytes 1-2 are a smallint in low-endian
  byte  3 is the length of the char field
  bytes 4-15 is the char field

byte  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  15
hex  D1  01  00  0C  72  65  63  76  20  73  6C  65  65  70  20  20
    209   1   0  12   r   e   c   v ' '   s   l   e   e   p ' ' ' '

Params - TDS 5.0 (0xD7 215)

TODO.

Capability - TDS 5.0 (0xE2 226)

 INT16    variable
+--------+--------------+
| length | capabilities |
+--------+--------------+

length		Length of capability string
capabilities	Server capabilities?  Related to login magic?

Environment change (0xE3 227)

 INT16    INT8       INT8        CHAR[n]   INT8        CHAR[n] 
+--------+----------+-----------+---------+-----------+---------+
| length | env code | t1 length |  text1  | t2 length |  text2  |
+--------+----------+-----------+---------+-----------+---------+

env code	Code for what part of environment changed
	0x01  database context
	0x02  language
	0x03  character set
	0x04  packet size
	0x05  TDS 7.0+ LCID
	0x06  TDS 7.0+ ??? (sort method? sql server encoding?)
	0x07  Collation info
text1		Old value
text2		New value

text1 and text2 are text information (coded in ucs2 in TDS 7.0+) except 
collation info that's a structure (see collation structure)

DBRPC - TDS 5.0 (0xE6 230)

TODO.

Dynamic - TDS 5.0 (0xE7 231)

TODO.

Param Format - TDS 5.0 (0xEC 236)

 INT16     INT16        variable size
+---------+------------+-------------------+
| length  | number of  | parameter info    |
|         | parameters |                   |
+---------+------------+-------------------+

length            	length of message following this field
number of parameters	number of parameter formats following
list of formats		I (*bdw*) imagine it uses the column format structure.

Authentication - TDS 7.0 (0xED 237)

 INT16     varies
+---------+------+
| length  | auth |
+---------+------+

length   length of authentication data following this field
auth     authentication data
         for NTLM this is message 2

Client reply with Authentication packet.

Result Set - TDS 5.0 (0xEE 238)

 INT16     INT16        variable size
+---------+------------+-----------------+
| length  | number of  | column info     |
|         | columns    |                 |
+---------+------------+-----------------+


Fields:
length             length of message following this field
number of columns  number of columns in the result set, this many column
                   information fields will follow.
column info        column info

Done Packets

Result Set Done (0xFD 253)
Process Done (0xFE 254)
Done Inside Process (0xFF 255)

 INT16       INT16     INT32                  INT64
+-----------+---------+----------------------+---------------------+
| bit flags | unknown | row count (TDS 7.1-) | row count (TDS 7.2) |
+-----------+---------+----------------------+---------------------+

Fields:
bit flags          0x01 more results
		   0x02 error (like invalid sql syntax)
		   0x10 row count is valid
		   0x20 cancelled
unknown            2,0  /* something to do with block size perhaps */
row count          number of rows affected / returned in the result set. 
                   row count is 64-bit using TDS 7.2.
		(FIXME check if "affected / returned" is correct)

"Result Set Complete" is the end of a query that doesn't create a process on the server. I.e., it doesn't call a stored procedure.
"Process Done" is the end of a stored procedure
"Done In Process" means that a query internal to a stored procedure has finished, but the stored procedure isn't done overall.


Acknowledgements

The following people have contributed to this document:

  • Brian Bruns (first draft, protocol discovery)
  • Brian Wheeler (protocol discovery)
  • Mark Schaal (second draft)
  • Frediano Ziglio

(short list)

Document Status

$Id: tds.html,v 1.41 2008-11-25 23:38:33 jklowden Exp $

Valid HTML 4.01 Strict

PK:iZ,d  &doc/freetds/ea-freetds-1.4.9/README.mdnu[README for FreeTDS 1.4 ==== *Release date 23th September 2023* **To build FreeTDS read the file [INSTALL](./INSTALL.md) or the [FreeTDS Users Guide](http://www.freetds.org/userguide/)** FreeTDS is a free implementation of Sybase's DB-Library, CT-Library, and ODBC libraries. FreeTDS builds and runs on every flavor of unix-like systems we've heard of (and some we haven't) as well as Win32 (with or without Cygwin), VMS, and Mac OS X. Failure to build on your system is probably considered a bug. It has C language bindings, and works also with Perl and PHP, among others. FreeTDS is licensed under the GNU LGPL license. See [COPYING_LIB.txt](./COPYING_LIB.txt) for details. Other files you might want to peruse: * [AUTHORS](./AUTHORS.md) Who's involved * [NEWS](./NEWS.md) Summary of feature changes and fixes * [TODO](./TODO.md) The roadmap, such as it is Also, [api_status](./doc/api_status.txt) shows which functions are implemented. For details on what's new in this version, see NEWS. For unbearable detail, see git log. Documentation ============= A User Guide, in XML and HTML form, is included in this distribution. Also included is a reference manual, generated in HTML with Doxygen. "make install" installs the HTML documentation, by default to /usr/local/share/doc/freetds-. Note to Users ============= Submissions of test programs (self-contained programs that demonstrate functionality or problems) are greatly appreciated. They should create any tables needed (since we obviously don't have access to your database) and populate them. Unit tests for any of the libraries is appreciated Notes to Developers =================== The code is split into several pieces. 1. `tds` directory is the wire level stuff, it should be independent of the library using it, this will allow db-lib, ct-lib, and ODBC to sit on top. 2. `db-lib` directory. This is the actual db-lib code which runs on top of tds. 3. `ct-lib` directory. This is the ct-lib code which runs on top of tds. 4. `server` directory. This will be a set of server routines basically to impersonate a dataserver, functions like send_login_ack() etc... 5. `odbc` directory. ODBC implementation over tds. Uses iODBC or unixODBC as a driver manager. You need to have one of those if you are using the ODBC CLI. 6. `unittests` directories. Test harness code for ct-lib, db-lib, ODBC and libtds. 7. `samples` directories. Sample code for getting started with Perl, PHP, etc... 8. `pool` directory. A connection pooling server for TDS. Useful if you have a connection limited license. Needs some hacking to get configured but is quite stable once configured correctly. Contact the list if interested in how to use it. Please look at doc/getting_started.txt for a description of what is going on in the code. Side note: Brian, as many free software authors, appreciates postcards from all over. So if you live someplace neat (read: not Michigan) and want to send one, email him (brian@bruns.org) for his current snail mail address. PK:iZFNFF(doc/freetds/ea-freetds-1.4.9/COPYING.txtnu[ GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. PK:iZd 'doc/freetds/ea-freetds-1.4.9/AUTHORS.mdnu[Brian Bruns Started this crazy thing James K. Lowden Documentation, maintainer from 2003 to early 2015. Marc Abramowitz Testing and patches, Travis CI tests. Koscheev Andrey Negative money patch. Craig A. Berry VMS support. James Cameron GNU standards compliance and minor fixes. Peter Deacon Lots of help, testing and patches. John F. Dumas Patch to fix memory leaks. David Fraser Testing and patches (NO-DM support). Scott Gray TDS 7.0 numeric support and bug fixes. Alex Hornby Testing and patches. Mihai Ibanescu GNUified the packet. Gregg Jensen Message handlers and extra datatype support and some sybperl stuff? Viktar Klimkovitch ODBC fixes to get libodbc++ working. Bob Kline NTEXT support. Lothar Krauss ODBC fixes. Steve Langasek Off by one fixes and autoconf byte size thing. Debian package maintainer. Mark J. Lilback Implementation of dbstrlen and dbstrcpy. Kevin Lyons Various TDS bug fixes. Steve Murphree Contributed a huge ODBC patch. Dennis Nicklaus vxWorks port and fixes for dbdata() and SYBVARBINARY. Arno Pedusaar Donated his TDS4.2 code to the cause. Brandon M. Reynolds Fix for arbitrarily large queries under dblib. Thomas Rogers Testing and patches. Mark Schaal Cleaned up message handling, bug fixes, ctlib unittests. Ken Seymour ODBC Driver Fixes. Craig Spannring JDBC driver and CVS repository. Martin Spott Testing and patches. Sam Tetherow Various TDS bug fixes. Bill Thompson BCP patches and datetime fixes. Patrick van Kleef Various bug fixes, dbcanquery() and odbc version checks. Geoff Winkless Lost connection stuff. Nicholas S. Castellano Many bug fixes and improvements, contributor of fisql application. Frediano Ziglio Lot of contributions, maintainer since 2015. Special thanks to Michael Peppler , author of the DBD::Sybase Perl module. Thanks go to the folks at A2i, Inc. (http://www.a2i.com) for funding the development of dblib host file bulk copy and writetext support, and to Dave Poyourow there for helping with the debugging. PK:iZ3֚((;doc/freetds/ea-freetds-libs-1.4.9/samples-odbc/odbctest.phpnu[ PK:iZ e 77Odoc/freetds/ea-freetds-libs-1.4.9/samples-odbc/unixodbc.freetds.driver.templatenu[# # $Id: unixodbc.freetds.driver.template.in,v 1.2 2006-09-13 11:56:37 freddy77 Exp $ # # FreeTDS - Library of routines accessing Sybase and Microsoft databases # Copyright (C) 1998-1999 Brian Bruns # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the # Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # [FreeTDS] Description = FreeTDS unixODBC Driver Driver = /opt/cpanel/freetds/lib64/libtdsodbc.so Setup = /opt/cpanel/freetds/lib64/libtdsodbc.so PK:iZ:doc/freetds/ea-freetds-libs-1.4.9/samples-odbc/odbctest.plnu[#!/usr/local/bin/perl # $Id: odbctest.pl,v 1.2 2005-04-04 22:05:33 jklowden Exp $ use DBI; my ($dsn, $user, $pass, $sql) = @ARGV; $dsn = "dbi:ODBC:JDBC" unless $dsn; $user = 'guest' unless $user; $pass = 'sybase' unless $pass; $sql ="select \@\@servername" unless $sql; my $dbh = DBI->connect($dsn, $user, $pass, {PrintError => 1}); die "Unable for connect to server $DBI::errstr" unless $dbh; my $rc; my $sth = $dbh->prepare($sql); if($sth->execute) { while(@dat = $sth->fetchrow) { print "@dat\n"; } } PK:iZg$Bdoc/freetds/ea-freetds-libs-1.4.9/samples-odbc/unixodbc.install.shnuȯ#! /bin/sh # # $Id: unixodbc.install.sh,v 1.1 2002-10-09 17:05:44 castellano Exp $ # # FreeTDS - Library of routines accessing Sybase and Microsoft databases # Copyright (C) 1998-1999 Brian Bruns # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the # Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # # Run this script as root to install FreeTDS unixODBC drivers and datasources. # # You will most likely want to edit unixodbc.jdbc.datasource.template # to add your own dataserver instead of the public Sybase dataserver. # # For more information about these template files, please see # http://www.unixodbc.org/doc/FreeTDS.html # # Install driver. odbcinst -i -d -f unixodbc.freetds.driver.template # Install system datasource. odbcinst -i -s -l -f unixodbc.jdbc.datasource.template PK:iZK007doc/freetds/ea-freetds-libs-1.4.9/samples-odbc/odbc.ininu[; ; odbc.ini ; [ODBC Data Sources] JDBC = Sybase JDBC Server [JDBC] Driver = /usr/local/lib/libtdsodbc.so Description = Sybase JDBC Server Trace = No Servername = JDBC Database = pubs2 UID = guest [Default] Driver = /usr/local/lib/libtdsodbc.so PK:iZhPdoc/freetds/ea-freetds-libs-1.4.9/samples-odbc/unixodbc.jdbc.datasource.templatenu[# # $Id: unixodbc.jdbc.datasource.template,v 1.1 2002-10-09 17:05:44 castellano Exp $ # # FreeTDS - Library of routines accessing Sybase and Microsoft databases # Copyright (C) 1998-1999 Brian Bruns # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the # Free Software Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # [JDBC] Driver = FreeTDS Description = Sybase JDBC Server Trace = No Servername = JDBC Database = pubs2 UID = guest PK:iZ[y'c'c1doc/freetds/ea-freetds-libs-1.4.9/COPYING_LIB.txtnu[ GNU LIBRARY GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the library GPL. It is numbered 2 because it goes with version 2 of the ordinary GPL.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Library General Public License, applies to some specially designated Free Software Foundation software, and to any other libraries whose authors decide to use it. You can use it for your libraries, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library, or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link a program with the library, you must provide complete object files to the recipients so that they can relink them with the library, after making changes to the library and recompiling it. And you must show them these terms so they know their rights. Our method of protecting your rights has two steps: (1) copyright the library, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the library. Also, for each distributor's protection, we want to make certain that everyone understands that there is no warranty for this free library. If the library is modified by someone else and passed on, we want its recipients to know that what they have is not the original version, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that companies distributing free software will individually obtain patent licenses, thus in effect transforming the program into proprietary software. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License, which was designed for utility programs. This license, the GNU Library General Public License, applies to certain designated libraries. This license is quite different from the ordinary one; be sure to read it in full, and don't assume that anything in it is the same as in the ordinary license. The reason we have a separate public license for some libraries is that they blur the distinction we usually make between modifying or adding to a program and simply using it. Linking a program with a library, without changing the library, is in some sense simply using the library, and is analogous to running a utility program or application program. However, in a textual and legal sense, the linked executable is a combined work, a derivative of the original library, and the ordinary General Public License treats it as such. Because of this blurred distinction, using the ordinary General Public License for libraries did not effectively promote software sharing, because most developers did not use the libraries. We concluded that weaker conditions might promote sharing better. However, unrestricted linking of non-free programs would deprive the users of those programs of all benefit from the free status of the libraries themselves. This Library General Public License is intended to permit developers of non-free programs to use free libraries, while preserving your freedom as a user of such programs to change the free libraries that are incorporated in them. (We have not seen how to achieve this as regards changes in header files, but we have achieved it as regards changes in the actual functions of the Library.) The hope is that this will lead to faster development of free libraries. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, while the latter only works together with the library. Note that it is possible for a library to be covered by the ordinary General Public License rather than by this special one. GNU LIBRARY GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Library General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also compile or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. c) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. d) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Library General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! PK:iZ~7doc/freetds/images/caution.gifnu[GIF87a!!11BBZZcckkss{{sss{s{cZcc19B191,uH_@Ȑ 6DHB $N$ 4>pиa (e|QGE(YaD`P 8j,XEJt@P?MeHL)%d)؝ JCgep`-[ tYb 16|o "ؕd=H)UDFW4  热-XċBݐ'ơ:o ;PK:iZs̚!doc/freetds/images/callouts/3.gifnu[GIF89a   !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~!, wG)98\ r@ ƹ!x0֌d.SAq$VDPsd1TBlE$gfe.FwV޽Vc,<M C҄;PK:iZBi͛!doc/freetds/images/callouts/8.gifnu[GIF89a   !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~!, x l%%E) |!8'PRެ ƽRxnCJ 108P\F%.s,aA9B'YD@;J8=c8sfw R";PK:iZDy!doc/freetds/images/callouts/2.gifnu[GIF89a   !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~!, pG)98\ R!{g A,e @=hDo("HfTrN+YsYS$5Ĉ!彇I=dà5- #gJ ;PK:iZdt"doc/freetds/images/callouts/10.gifnu[GIF89a   !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~!,   . ÛjJ9)) ZxHIDg_7s|3P.urF@b5<ڋ^0Up\F ;PK:iZiЗ!doc/freetds/images/callouts/5.gifnu[GIF89a   !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~!, t  .)B@Ûr0|N Jȓ*le )9P`@;PK:iZ~ϲ!doc/freetds/images/callouts/1.gifnu[GIF89a   !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~!, _G)98\ 9 =F##K#N+#%/cI3&{(D-  ;PK:iZu]AF!doc/freetds/images/callouts/7.gifnu[GIF89a   !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~!, k %%E % wO  !@qN ƽ^Bp"J&E2G {͐jD2?)0c ) Ykh BN9 HQT`@;PK:iZ߶!doc/freetds/images/callouts/4.gifnu[GIF89a   !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~!, p l%%E % 8'C%8qC(jtH"VލC- [e)1r A1 rcG3?2㨷5{(K;PK:iZg!doc/freetds/images/callouts/9.gifnu[GIF89a   !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~!, | l%%E) wO ݹsr:̉5Jcr/92@>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~!, z l%%E %  )8'!RC ǽVÀ],+"G108<ΙMثCg`] 2w{Hqɜ/SxSxK1 ;PK:iZ2U/doc/freetds/images/tip.gifnu[GIF87a  !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~, HA*xX)J"Btvoa{&!%J,2M3QUQsj)TK!s W&tV{{BYTI7yFЛх*^Uh k`֔x˞ )Hv[?]m&V'^BxpBÀ#DẂV2 g-Oz3& kQ«k='ۘɔ=x"m|_@;PK:iZo>s99 doc/freetds/images/important.gifnu[GIF87a)))999BB1BBBJJJRRRZZ)ccccRccckkBkkkssR{{{9{ZZc{c!9k{JRZZsRck!19R!)1Zc{1B19J!,HpA*ܲĆ ""Bae!A+3,|ҤcG,0$WRTC dd͔ML9& |ܰs 5WR@ARM< $J rSG 8Pܼ"i'c9,""LdOW`+D2ͫ2$ou;w ;PK:iZo..doc/freetds/images/note.gifnu[GIF87a  !!!"""###$$$%%%&&&'''((()))***+++,,,---...///000111222333444555666777888999:::;;;<<<===>>>???@@@AAABBBCCCDDDEEEFFFGGGHHHIIIJJJKKKLLLMMMNNNOOOPPPQQQRRRSSSTTTUUUVVVWWWXXXYYYZZZ[[[\\\]]]^^^___```aaabbbcccdddeeefffggghhhiiijjjkkklllmmmnnnooopppqqqrrrssstttuuuvvvwwwxxxyyyzzz{{{|||}}}~~~, HA*ثR:[1F{1J&R<(Zʓ[Hi&L5 :+ub)LS`QzRAJ5kr͚3F Ftn9 <Ҙ9Mu lFQE=5k-5Szҿw=QbsT¸$eJ{Jq\ǫ=@W˚Z!l3ƦR<-%3!c[B*'{ƚxyǨ^Sj lĊQ9o;6$H;PK:iZGїYUU doc/freetds/userguide/index.htmlnu[

at www.freetds.org PKn;iZ+q+qman/man1/nghttpx.1nu[.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "NGHTTPX" "1" "Apr 04, 2024" "1.61.0" "nghttp2" .SH NAME nghttpx \- HTTP/2 proxy .SH SYNOPSIS .sp \fBnghttpx\fP [OPTIONS]... [ ] .SH DESCRIPTION .sp A reverse proxy for HTTP/3, HTTP/2, and HTTP/1. .INDENT 0.0 .TP .B Set path to server\(aqs private key. Required unless \(dqno\-tls\(dq parameter is used in \fI\%\-\-frontend\fP option. .UNINDENT .INDENT 0.0 .TP .B Set path to server\(aqs certificate. Required unless \(dqno\-tls\(dq parameter is used in \fI\%\-\-frontend\fP option. To make OCSP stapling work, this must be an absolute path. .UNINDENT .SH OPTIONS .sp The options are categorized into several groups. .SS Connections .INDENT 0.0 .TP .B \-b, \-\-backend=(,|unix:)[;[[:...]][[;]...] Set backend host and port. The multiple backend addresses are accepted by repeating this option. UNIX domain socket can be specified by prefixing path name with \(dqunix:\(dq (e.g., unix:/var/run/backend.sock). .sp Optionally, if s are given, the backend address is only used if request matches the pattern. The pattern matching is closely designed to ServeMux in net/http package of Go programming language. consists of path, host + path or just host. The path must start with \(dq\fI/\fP\(dq. If it ends with \(dq\fI/\fP\(dq, it matches all request path in its subtree. To deal with the request to the directory without trailing slash, the path which ends with \(dq\fI/\fP\(dq also matches the request path which only lacks trailing \(aq\fI/\fP\(aq (e.g., path \(dq\fI/foo/\fP\(dq matches request path \(dq\fI/foo\fP\(dq). If it does not end with \(dq\fI/\fP\(dq, it performs exact match against the request path. If host is given, it performs a match against the request host. For a request received on the frontend listener with \(dqsni\-fwd\(dq parameter enabled, SNI host is used instead of a request host. If host alone is given, \(dq\fI/\fP\(dq is appended to it, so that it matches all request paths under the host (e.g., specifying \(dqnghttp2.org\(dq equals to \(dqnghttp2.org/\(dq). CONNECT method is treated specially. It does not have path, and we don\(aqt allow empty path. To workaround this, we assume that CONNECT method has \(dq\fI/\fP\(dq as path. .sp Patterns with host take precedence over patterns with just path. Then, longer patterns take precedence over shorter ones. .sp Host can include \(dq*\(dq in the left most position to indicate wildcard match (only suffix match is done). The \(dq*\(dq must match at least one character. For example, host pattern \(dq*.nghttp2.org\(dq matches against \(dqwww.nghttp2.org\(dq and \(dqgit.ngttp2.org\(dq, but does not match against \(dqnghttp2.org\(dq. The exact hosts match takes precedence over the wildcard hosts match. .sp If path part ends with \(dq*\(dq, it is treated as wildcard path. The wildcard path behaves differently from the normal path. For normal path, match is made around the boundary of path component separator,\(dq\fI/\fP\(dq. On the other hand, the wildcard path does not take into account the path component separator. All paths which include the wildcard path without last \(dq*\(dq as prefix, and are strictly longer than wildcard path without last \(dq*\(dq are matched. \(dq*\(dq must match at least one character. For example, the pattern \(dq\fI/foo*\fP\(dq matches \(dq\fI/foo/\fP\(dq and \(dq\fI/foobar\fP\(dq. But it does not match \(dq\fI/foo\fP\(dq, or \(dq\fI/fo\fP\(dq. .sp If is omitted or empty string, \(dq\fI/\fP\(dq is used as pattern, which matches all request paths (catch\-all pattern). The catch\-all backend must be given. .sp When doing a match, nghttpx made some normalization to pattern, request host and path. For host part, they are converted to lower case. For path part, percent\-encoded unreserved characters defined in RFC 3986 are decoded, and any dot\-segments (\(dq..\(dq and \(dq.\(dq) are resolved and removed. .sp For example, \fI\%\-b\fP\(aq127.0.0.1,8080;nghttp2.org/httpbin/\(aq matches the request host \(dqnghttp2.org\(dq and the request path \(dq\fI/httpbin/get\fP\(dq, but does not match the request host \(dqnghttp2.org\(dq and the request path \(dq\fI/index.html\fP\(dq. .sp The multiple s can be specified, delimiting them by \(dq:\(dq. Specifying \fI\%\-b\fP\(aq127.0.0.1,8080;nghttp2.org:www.nghttp2.org\(aq has the same effect to specify \fI\%\-b\fP\(aq127.0.0.1,8080;nghttp2.org\(aq and \fI\%\-b\fP\(aq127.0.0.1,8080;www.nghttp2.org\(aq. .sp The backend addresses sharing same are grouped together forming load balancing group. .sp Several parameters are accepted after . The parameters are delimited by \(dq;\(dq. The available parameters are: \(dqproto=\(dq, \(dqtls\(dq, \(dqsni=\(dq, \(dqfall=\(dq, \(dqrise=\(dq, \(dqaffinity=\(dq, \(dqdns\(dq, \(dqredirect\-if\-not\-tls\(dq, \(dqupgrade\-scheme\(dq, \(dqmruby=\(dq, \(dqread\-timeout=\(dq, \(dqwrite\-timeout=\(dq, \(dqgroup=\(dq, \(dqgroup\-weight=\(dq, \(dqweight=\(dq, and \(dqdnf\(dq. The parameter consists of keyword, and optionally followed by \(dq=\(dq and value. For example, the parameter \(dqproto=h2\(dq consists of the keyword \(dqproto\(dq and value \(dqh2\(dq. The parameter \(dqtls\(dq consists of the keyword \(dqtls\(dq without value. Each parameter is described as follows. .sp The backend application protocol can be specified using optional \(dqproto\(dq parameter, and in the form of \(dqproto=\(dq. should be one of the following list without quotes: \(dqh2\(dq, \(dqhttp/1.1\(dq. The default value of is \(dqhttp/1.1\(dq. Note that usually \(dqh2\(dq refers to HTTP/2 over TLS. But in this option, it may mean HTTP/2 over cleartext TCP unless \(dqtls\(dq keyword is used (see below). .sp TLS can be enabled by specifying optional \(dqtls\(dq parameter. TLS is not enabled by default. .sp With \(dqsni=\(dq parameter, it can override the TLS SNI field value with given . This will default to the backend name .sp The feature to detect whether backend is online or offline can be enabled using optional \(dqfall\(dq and \(dqrise\(dq parameters. Using \(dqfall=\(dq parameter, if nghttpx cannot connect to a this backend times in a row, this backend is assumed to be offline, and it is excluded from load balancing. If is 0, this backend never be excluded from load balancing whatever times nghttpx cannot connect to it, and this is the default. There is also \(dqrise=\(dq parameter. After backend was excluded from load balancing group, nghttpx periodically attempts to make a connection to the failed backend, and if the connection is made successfully times in a row, the backend is assumed to be online, and it is now eligible for load balancing target. If is 0, a backend is permanently offline, once it goes in that state, and this is the default behaviour. .sp The session affinity is enabled using \(dqaffinity=\(dq parameter. If \(dqip\(dq is given in , client IP based session affinity is enabled. If \(dqcookie\(dq is given in , cookie based session affinity is enabled. If \(dqnone\(dq is given in , session affinity is disabled, and this is the default. The session affinity is enabled per . If at least one backend has \(dqaffinity\(dq parameter, and its is not \(dqnone\(dq, session affinity is enabled for all backend servers sharing the same . It is advised to set \(dqaffinity\(dq parameter to all backend explicitly if session affinity is desired. The session affinity may break if one of the backend gets unreachable, or backend settings are reloaded or replaced by API. .sp If \(dqaffinity=cookie\(dq is used, the additional configuration is required. \(dqaffinity\-cookie\-name=\(dq must be used to specify a name of cookie to use. Optionally, \(dqaffinity\-cookie\-path=\(dq can be used to specify a path which cookie is applied. The optional \(dqaffinity\-cookie\-secure=\(dq controls the Secure attribute of a cookie. The default value is \(dqauto\(dq, and the Secure attribute is determined by a request scheme. If a request scheme is \(dqhttps\(dq, then Secure attribute is set. Otherwise, it is not set. If is \(dqyes\(dq, the Secure attribute is always set. If is \(dqno\(dq, the Secure attribute is always omitted. \(dqaffinity\-cookie\-stickiness=\(dq controls stickiness of this affinity. If is \(dqloose\(dq, removing or adding a backend server might break the affinity and the request might be forwarded to a different backend server. If is \(dqstrict\(dq, removing the designated backend server breaks affinity, but adding new backend server does not cause breakage. If the designated backend server becomes unavailable, new backend server is chosen as if the request does not have an affinity cookie. defaults to \(dqloose\(dq. .sp By default, name resolution of backend host name is done at start up, or reloading configuration. If \(dqdns\(dq parameter is given, name resolution takes place dynamically. This is useful if backend address changes frequently. If \(dqdns\(dq is given, name resolution of backend host name at start up, or reloading configuration is skipped. .sp If \(dqredirect\-if\-not\-tls\(dq parameter is used, the matched backend requires that frontend connection is TLS encrypted. If it isn\(aqt, nghttpx responds to the request with 308 status code, and https URI the client should use instead is included in Location header field. The port number in redirect URI is 443 by default, and can be changed using \fI\%\-\-redirect\-https\-port\fP option. If at least one backend has \(dqredirect\-if\-not\-tls\(dq parameter, this feature is enabled for all backend servers sharing the same . It is advised to set \(dqredirect\-if\-no\-tls\(dq parameter to all backends explicitly if this feature is desired. .sp If \(dqupgrade\-scheme\(dq parameter is used along with \(dqtls\(dq parameter, HTTP/2 :scheme pseudo header field is changed to \(dqhttps\(dq from \(dqhttp\(dq when forwarding a request to this particular backend. This is a workaround for a backend server which requires \(dqhttps\(dq :scheme pseudo header field on TLS encrypted connection. .sp \(dqmruby=\(dq parameter specifies a path to mruby script file which is invoked when this pattern is matched. All backends which share the same pattern must have the same mruby path. .sp \(dqread\-timeout=\(dq and \(dqwrite\-timeout=\(dq parameters specify the read and write timeout of the backend connection when this pattern is matched. All backends which share the same pattern must have the same timeouts. If these timeouts are entirely omitted for a pattern, \fI\%\-\-backend\-read\-timeout\fP and \fI\%\-\-backend\-write\-timeout\fP are used. .sp \(dqgroup=\(dq parameter specifies the name of group this backend address belongs to. By default, it belongs to the unnamed default group. The name of group is unique per pattern. \(dqgroup\-weight=\(dq parameter specifies the weight of the group. The higher weight gets more frequently selected by the load balancing algorithm. must be [1, 256] inclusive. The weight 8 has 4 times more weight than 2. must be the same for all addresses which share the same . If \(dqgroup\-weight\(dq is omitted in an address, but the other address which belongs to the same group specifies \(dqgroup\-weight\(dq, its weight is used. If no \(dqgroup\-weight\(dq is specified for all addresses, the weight of a group becomes 1. \(dqgroup\(dq and \(dqgroup\-weight\(dq are ignored if session affinity is enabled. .sp \(dqweight=\(dq parameter specifies the weight of the backend address inside a group which this address belongs to. The higher weight gets more frequently selected by the load balancing algorithm. must be [1, 256] inclusive. The weight 8 has 4 times more weight than weight 2. If this parameter is omitted, weight becomes 1. \(dqweight\(dq is ignored if session affinity is enabled. .sp If \(dqdnf\(dq parameter is specified, an incoming request is not forwarded to a backend and just consumed along with the request body (actually a backend server never be contacted). It is expected that the HTTP response is generated by mruby script (see \(dqmruby=\(dq parameter above). \(dqdnf\(dq is an abbreviation of \(dqdo not forward\(dq. .sp Since \(dq;\(dq and \(dq:\(dq are used as delimiter, must not contain these characters. In order to include \(dq:\(dq in , one has to specify \(dq%3A\(dq (which is percent\-encoded from of \(dq:\(dq) instead. Since \(dq;\(dq has special meaning in shell, the option value must be quoted. .sp Default: \fB127.0.0.1,80\fP .UNINDENT .INDENT 0.0 .TP .B \-f, \-\-frontend=(,|unix:)[[;]...] Set frontend host and port. If is \(aq*\(aq, it assumes all addresses including both IPv4 and IPv6. UNIX domain socket can be specified by prefixing path name with \(dqunix:\(dq (e.g., unix:/var/run/nghttpx.sock). This option can be used multiple times to listen to multiple addresses. .sp This option can take 0 or more parameters, which are described below. Note that \(dqapi\(dq and \(dqhealthmon\(dq parameters are mutually exclusive. .sp Optionally, TLS can be disabled by specifying \(dqno\-tls\(dq parameter. TLS is enabled by default. .sp If \(dqsni\-fwd\(dq parameter is used, when performing a match to select a backend server, SNI host name received from the client is used instead of the request host. See \fI\%\-\-backend\fP option about the pattern match. .sp To make this frontend as API endpoint, specify \(dqapi\(dq parameter. This is disabled by default. It is important to limit the access to the API frontend. Otherwise, someone may change the backend server, and break your services, or expose confidential information to the outside the world. .sp To make this frontend as health monitor endpoint, specify \(dqhealthmon\(dq parameter. This is disabled by default. Any requests which come through this address are replied with 200 HTTP status, without no body. .sp To accept PROXY protocol version 1 and 2 on frontend connection, specify \(dqproxyproto\(dq parameter. This is disabled by default. .sp To receive HTTP/3 (QUIC) traffic, specify \(dqquic\(dq parameter. It makes nghttpx listen on UDP port rather than TCP port. UNIX domain socket, \(dqapi\(dq, and \(dqhealthmon\(dq parameters cannot be used with \(dqquic\(dq parameter. .sp Default: \fB*,3000\fP .UNINDENT .INDENT 0.0 .TP .B \-\-backlog= Set listen backlog size. .sp Default: \fB65536\fP .UNINDENT .INDENT 0.0 .TP .B \-\-backend\-address\-family=(auto|IPv4|IPv6) Specify address family of backend connections. If \(dqauto\(dq is given, both IPv4 and IPv6 are considered. If \(dqIPv4\(dq is given, only IPv4 address is considered. If \(dqIPv6\(dq is given, only IPv6 address is considered. .sp Default: \fBauto\fP .UNINDENT .INDENT 0.0 .TP .B \-\-backend\-http\-proxy\-uri= Specify proxy URI in the form \fI\%http:/\fP/[:@]:. If a proxy requires authentication, specify and . Note that they must be properly percent\-encoded. This proxy is used when the backend connection is HTTP/2. First, make a CONNECT request to the proxy and it connects to the backend on behalf of nghttpx. This forms tunnel. After that, nghttpx performs SSL/TLS handshake with the downstream through the tunnel. The timeouts when connecting and making CONNECT request can be specified by \fI\%\-\-backend\-read\-timeout\fP and \fI\%\-\-backend\-write\-timeout\fP options. .UNINDENT .SS Performance .INDENT 0.0 .TP .B \-n, \-\-workers= Set the number of worker threads. .sp Default: \fB1\fP .UNINDENT .INDENT 0.0 .TP .B \-\-single\-thread Run everything in one thread inside the worker process. This feature is provided for better debugging experience, or for the platforms which lack thread support. If threading is disabled, this option is always enabled. .UNINDENT .INDENT 0.0 .TP .B \-\-read\-rate= Set maximum average read rate on frontend connection. Setting 0 to this option means read rate is unlimited. .sp Default: \fB0\fP .UNINDENT .INDENT 0.0 .TP .B \-\-read\-burst= Set maximum read burst size on frontend connection. Setting 0 to this option means read burst size is unlimited. .sp Default: \fB0\fP .UNINDENT .INDENT 0.0 .TP .B \-\-write\-rate= Set maximum average write rate on frontend connection. Setting 0 to this option means write rate is unlimited. .sp Default: \fB0\fP .UNINDENT .INDENT 0.0 .TP .B \-\-write\-burst= Set maximum write burst size on frontend connection. Setting 0 to this option means write burst size is unlimited. .sp Default: \fB0\fP .UNINDENT .INDENT 0.0 .TP .B \-\-worker\-read\-rate= Set maximum average read rate on frontend connection per worker. Setting 0 to this option means read rate is unlimited. Not implemented yet. .sp Default: \fB0\fP .UNINDENT .INDENT 0.0 .TP .B \-\-worker\-read\-burst= Set maximum read burst size on frontend connection per worker. Setting 0 to this option means read burst size is unlimited. Not implemented yet. .sp Default: \fB0\fP .UNINDENT .INDENT 0.0 .TP .B \-\-worker\-write\-rate= Set maximum average write rate on frontend connection per worker. Setting 0 to this option means write rate is unlimited. Not implemented yet. .sp Default: \fB0\fP .UNINDENT .INDENT 0.0 .TP .B \-\-worker\-write\-burst= Set maximum write burst size on frontend connection per worker. Setting 0 to this option means write burst size is unlimited. Not implemented yet. .sp Default: \fB0\fP .UNINDENT .INDENT 0.0 .TP .B \-\-worker\-frontend\-connections= Set maximum number of simultaneous connections frontend accepts. Setting 0 means unlimited. .sp Default: \fB0\fP .UNINDENT .INDENT 0.0 .TP .B \-\-backend\-connections\-per\-host= Set maximum number of backend concurrent connections (and/or streams in case of HTTP/2) per origin host. This option is meaningful when \fI\%\-\-http2\-proxy\fP option is used. The origin host is determined by authority portion of request URI (or :authority header field for HTTP/2). To limit the number of connections per frontend for default mode, use \fI\%\-\-backend\-connections\-per\-frontend\fP\&. .sp Default: \fB8\fP .UNINDENT .INDENT 0.0 .TP .B \-\-backend\-connections\-per\-frontend= Set maximum number of backend concurrent connections (and/or streams in case of HTTP/2) per frontend. This option is only used for default mode. 0 means unlimited. To limit the number of connections per host with \fI\%\-\-http2\-proxy\fP option, use \fI\%\-\-backend\-connections\-per\-host\fP\&. .sp Default: \fB0\fP .UNINDENT .INDENT 0.0 .TP .B \-\-rlimit\-nofile= Set maximum number of open files (RLIMIT_NOFILE) to . If 0 is given, nghttpx does not set the limit. .sp Default: \fB0\fP .UNINDENT .INDENT 0.0 .TP .B \-\-rlimit\-memlock= Set maximum number of bytes of memory that may be locked into RAM. If 0 is given, nghttpx does not set the limit. .sp Default: \fB0\fP .UNINDENT .INDENT 0.0 .TP .B \-\-backend\-request\-buffer= Set buffer size used to store backend request. .sp Default: \fB16K\fP .UNINDENT .INDENT 0.0 .TP .B \-\-backend\-response\-buffer= Set buffer size used to store backend response. .sp Default: \fB128K\fP .UNINDENT .INDENT 0.0 .TP .B \-\-fastopen= Enables \(dqTCP Fast Open\(dq for the listening socket and limits the maximum length for the queue of connections that have not yet completed the three\-way handshake. If value is 0 then fast open is disabled. .sp Default: \fB0\fP .UNINDENT .INDENT 0.0 .TP .B \-\-no\-kqueue Don\(aqt use kqueue. This option is only applicable for the platforms which have kqueue. For other platforms, this option will be simply ignored. .UNINDENT .SS Timeout .INDENT 0.0 .TP .B \-\-frontend\-http2\-idle\-timeout= Specify idle timeout for HTTP/2 frontend connection. If no active streams exist for this duration, connection is closed. .sp Default: \fB3m\fP .UNINDENT .INDENT 0.0 .TP .B \-\-frontend\-http3\-idle\-timeout= Specify idle timeout for HTTP/3 frontend connection. If no active streams exist for this duration, connection is closed. .sp Default: \fB3m\fP .UNINDENT .INDENT 0.0 .TP .B \-\-frontend\-write\-timeout= Specify write timeout for all frontend connections. .sp Default: \fB30s\fP .UNINDENT .INDENT 0.0 .TP .B \-\-frontend\-keep\-alive\-timeout= Specify keep\-alive timeout for frontend HTTP/1 connection. .sp Default: \fB1m\fP .UNINDENT .INDENT 0.0 .TP .B \-\-frontend\-header\-timeout= Specify duration that the server waits for an HTTP request header fields to be received completely. On timeout, HTTP/1 and HTTP/2 connections are closed. For HTTP/3, the stream is shutdown, and the connection itself is left intact. .sp Default: \fB1m\fP .UNINDENT .INDENT 0.0 .TP .B \-\-stream\-read\-timeout= Specify read timeout for HTTP/2 streams. 0 means no timeout. .sp Default: \fB0\fP .UNINDENT .INDENT 0.0 .TP .B \-\-stream\-write\-timeout= Specify write timeout for HTTP/2 streams. 0 means no timeout. .sp Default: \fB1m\fP .UNINDENT .INDENT 0.0 .TP .B \-\-backend\-read\-timeout= Specify read timeout for backend connection. .sp Default: \fB1m\fP .UNINDENT .INDENT 0.0 .TP .B \-\-backend\-write\-timeout= Specify write timeout for backend connection. .sp Default: \fB30s\fP .UNINDENT .INDENT 0.0 .TP .B \-\-backend\-connect\-timeout= Specify timeout before establishing TCP connection to backend. .sp Default: \fB30s\fP .UNINDENT .INDENT 0.0 .TP .B \-\-backend\-keep\-alive\-timeout= Specify keep\-alive timeout for backend HTTP/1 connection. .sp Default: \fB2s\fP .UNINDENT .INDENT 0.0 .TP .B \-\-listener\-disable\-timeout= After accepting connection failed, connection listener is disabled for a given amount of time. Specifying 0 disables this feature. .sp Default: \fB30s\fP .UNINDENT .INDENT 0.0 .TP .B \-\-frontend\-http2\-setting\-timeout= Specify timeout before SETTINGS ACK is received from client. .sp Default: \fB10s\fP .UNINDENT .INDENT 0.0 .TP .B \-\-backend\-http2\-settings\-timeout= Specify timeout before SETTINGS ACK is received from backend server. .sp Default: \fB10s\fP .UNINDENT .INDENT 0.0 .TP .B \-\-backend\-max\-backoff= Specify maximum backoff interval. This is used when doing health check against offline backend (see \(dqfail\(dq parameter in \fI\%\-\-backend\fP option). It is also used to limit the maximum interval to temporarily disable backend when nghttpx failed to connect to it. These intervals are calculated using exponential backoff, and consecutive failed attempts increase the interval. This option caps its maximum value. .sp Default: \fB2m\fP .UNINDENT .SS SSL/TLS .INDENT 0.0 .TP .B \-\-ciphers= Set allowed cipher list for frontend connection. The format of the string is described in OpenSSL ciphers(1). This option sets cipher suites for TLSv1.2 or earlier. Use \fI\%\-\-tls13\-ciphers\fP for TLSv1.3. .sp Default: \fBECDHE\-ECDSA\-AES128\-GCM\-SHA256:ECDHE\-RSA\-AES128\-GCM\-SHA256:ECDHE\-ECDSA\-AES256\-GCM\-SHA384:ECDHE\-RSA\-AES256\-GCM\-SHA384:ECDHE\-ECDSA\-CHACHA20\-POLY1305:ECDHE\-RSA\-CHACHA20\-POLY1305:DHE\-RSA\-AES128\-GCM\-SHA256:DHE\-RSA\-AES256\-GCM\-SHA384\fP .UNINDENT .INDENT 0.0 .TP .B \-\-tls13\-ciphers= Set allowed cipher list for frontend connection. The format of the string is described in OpenSSL ciphers(1). This option sets cipher suites for TLSv1.3. Use \fI\%\-\-ciphers\fP for TLSv1.2 or earlier. .sp Default: \fBTLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256\fP .UNINDENT .INDENT 0.0 .TP .B \-\-client\-ciphers= Set allowed cipher list for backend connection. The format of the string is described in OpenSSL ciphers(1). This option sets cipher suites for TLSv1.2 or earlier. Use \fI\%\-\-tls13\-client\-ciphers\fP for TLSv1.3. .sp Default: \fBECDHE\-ECDSA\-AES128\-GCM\-SHA256:ECDHE\-RSA\-AES128\-GCM\-SHA256:ECDHE\-ECDSA\-AES256\-GCM\-SHA384:ECDHE\-RSA\-AES256\-GCM\-SHA384:ECDHE\-ECDSA\-CHACHA20\-POLY1305:ECDHE\-RSA\-CHACHA20\-POLY1305:DHE\-RSA\-AES128\-GCM\-SHA256:DHE\-RSA\-AES256\-GCM\-SHA384\fP .UNINDENT .INDENT 0.0 .TP .B \-\-tls13\-client\-ciphers= Set allowed cipher list for backend connection. The format of the string is described in OpenSSL ciphers(1). This option sets cipher suites for TLSv1.3. Use \fI\%\-\-tls13\-client\-ciphers\fP for TLSv1.2 or earlier. .sp Default: \fBTLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256\fP .UNINDENT .INDENT 0.0 .TP .B \-\-ecdh\-curves= Set supported curve list for frontend connections. is a colon separated list of curve NID or names in the preference order. The supported curves depend on the linked OpenSSL library. This function requires OpenSSL >= 1.0.2. .sp Default: \fBX25519:P\-256:P\-384:P\-521\fP .UNINDENT .INDENT 0.0 .TP .B \-k, \-\-insecure Don\(aqt verify backend server\(aqs certificate if TLS is enabled for backend connections. .UNINDENT .INDENT 0.0 .TP .B \-\-cacert= Set path to trusted CA certificate file. It is used in backend TLS connections to verify peer\(aqs certificate. It is also used to verify OCSP response from the script set by \fI\%\-\-fetch\-ocsp\-response\-file\fP\&. The file must be in PEM format. It can contain multiple certificates. If the linked OpenSSL is configured to load system wide certificates, they are loaded at startup regardless of this option. .UNINDENT .INDENT 0.0 .TP .B \-\-private\-key\-passwd\-file= Path to file that contains password for the server\(aqs private key. If none is given and the private key is password protected it\(aqll be requested interactively. .UNINDENT .INDENT 0.0 .TP .B \-\-subcert=:[[;]...] Specify additional certificate and private key file. nghttpx will choose certificates based on the hostname indicated by client using TLS SNI extension. If nghttpx is built with OpenSSL >= 1.0.2, the shared elliptic curves (e.g., P\-256) between client and server are also taken into consideration. This allows nghttpx to send ECDSA certificate to modern clients, while sending RSA based certificate to older clients. This option can be used multiple times. To make OCSP stapling work, must be absolute path. .sp Additional parameter can be specified in . The available is \(dqsct\-dir=

\(dq. .sp \(dqsct\-dir=\(dq specifies the path to directory which contains *.sct files for TLS signed_certificate_timestamp extension (RFC 6962). This feature requires OpenSSL >= 1.0.2. See also \fI\%\-\-tls\-sct\-dir\fP option. .UNINDENT .INDENT 0.0 .TP .B \-\-dh\-param\-file= Path to file that contains DH parameters in PEM format. Without this option, DHE cipher suites are not available. .UNINDENT .INDENT 0.0 .TP .B \-\-alpn\-list= Comma delimited list of ALPN protocol identifier sorted in the order of preference. That means most desirable protocol comes first. The parameter must be delimited by a single comma only and any white spaces are treated as a part of protocol string. .sp Default: \fBh2,h2\-16,h2\-14,http/1.1\fP .UNINDENT .INDENT 0.0 .TP .B \-\-verify\-client Require and verify client certificate. .UNINDENT .INDENT 0.0 .TP .B \-\-verify\-client\-cacert= Path to file that contains CA certificates to verify client certificate. The file must be in PEM format. It can contain multiple certificates. .UNINDENT .INDENT 0.0 .TP .B \-\-verify\-client\-tolerate\-expired Accept expired client certificate. Operator should handle the expired client certificate by some means (e.g., mruby script). Otherwise, this option might cause a security risk. .UNINDENT .INDENT 0.0 .TP .B \-\-client\-private\-key\-file= Path to file that contains client private key used in backend client authentication. .UNINDENT .INDENT 0.0 .TP .B \-\-client\-cert\-file= Path to file that contains client certificate used in backend client authentication. .UNINDENT .INDENT 0.0 .TP .B \-\-tls\-min\-proto\-version= Specify minimum SSL/TLS protocol. The name matching is done in case\-insensitive manner. The versions between \fI\%\-\-tls\-min\-proto\-version\fP and \fI\%\-\-tls\-max\-proto\-version\fP are enabled. If the protocol list advertised by client does not overlap this range, you will receive the error message \(dqunknown protocol\(dq. If a protocol version lower than TLSv1.2 is specified, make sure that the compatible ciphers are included in \fI\%\-\-ciphers\fP option. The default cipher list only includes ciphers compatible with TLSv1.2 or above. The available versions are: TLSv1.3, TLSv1.2, TLSv1.1, and TLSv1.0 .sp Default: \fBTLSv1.2\fP .UNINDENT .INDENT 0.0 .TP .B \-\-tls\-max\-proto\-version= Specify maximum SSL/TLS protocol. The name matching is done in case\-insensitive manner. The versions between \fI\%\-\-tls\-min\-proto\-version\fP and \fI\%\-\-tls\-max\-proto\-version\fP are enabled. If the protocol list advertised by client does not overlap this range, you will receive the error message \(dqunknown protocol\(dq. The available versions are: TLSv1.3, TLSv1.2, TLSv1.1, and TLSv1.0 .sp Default: \fBTLSv1.3\fP .UNINDENT .INDENT 0.0 .TP .B \-\-tls\-ticket\-key\-file= Path to file that contains random data to construct TLS session ticket parameters. If aes\-128\-cbc is given in \fI\%\-\-tls\-ticket\-key\-cipher\fP, the file must contain exactly 48 bytes. If aes\-256\-cbc is given in \fI\%\-\-tls\-ticket\-key\-cipher\fP, the file must contain exactly 80 bytes. This options can be used repeatedly to specify multiple ticket parameters. If several files are given, only the first key is used to encrypt TLS session tickets. Other keys are accepted but server will issue new session ticket with first key. This allows session key rotation. Please note that key rotation does not occur automatically. User should rearrange files or change options values and restart nghttpx gracefully. If opening or reading given file fails, all loaded keys are discarded and it is treated as if none of this option is given. If this option is not given or an error occurred while opening or reading a file, key is generated every 1 hour internally and they are valid for 12 hours. This is recommended if ticket key sharing between nghttpx instances is not required. .UNINDENT .INDENT 0.0 .TP .B \-\-tls\-ticket\-key\-memcached=,[;tls] Specify address of memcached server to get TLS ticket keys for session resumption. This enables shared TLS ticket key between multiple nghttpx instances. nghttpx does not set TLS ticket key to memcached. The external ticket key generator is required. nghttpx just gets TLS ticket keys from memcached, and use them, possibly replacing current set of keys. It is up to extern TLS ticket key generator to rotate keys frequently. See \(dqTLS SESSION TICKET RESUMPTION\(dq section in manual page to know the data format in memcached entry. Optionally, memcached connection can be encrypted with TLS by specifying \(dqtls\(dq parameter. .UNINDENT .INDENT 0.0 .TP .B \-\-tls\-ticket\-key\-memcached\-address\-family=(auto|IPv4|IPv6) Specify address family of memcached connections to get TLS ticket keys. If \(dqauto\(dq is given, both IPv4 and IPv6 are considered. If \(dqIPv4\(dq is given, only IPv4 address is considered. If \(dqIPv6\(dq is given, only IPv6 address is considered. .sp Default: \fBauto\fP .UNINDENT .INDENT 0.0 .TP .B \-\-tls\-ticket\-key\-memcached\-interval= Set interval to get TLS ticket keys from memcached. .sp Default: \fB10m\fP .UNINDENT .INDENT 0.0 .TP .B \-\-tls\-ticket\-key\-memcached\-max\-retry= Set maximum number of consecutive retries before abandoning TLS ticket key retrieval. If this number is reached, the attempt is considered as failure, and \(dqfailure\(dq count is incremented by 1, which contributed to the value controlled \fI\%\-\-tls\-ticket\-key\-memcached\-max\-fail\fP option. .sp Default: \fB3\fP .UNINDENT .INDENT 0.0 .TP .B \-\-tls\-ticket\-key\-memcached\-max\-fail= Set maximum number of consecutive failure before disabling TLS ticket until next scheduled key retrieval. .sp Default: \fB2\fP .UNINDENT .INDENT 0.0 .TP .B \-\-tls\-ticket\-key\-cipher= Specify cipher to encrypt TLS session ticket. Specify either aes\-128\-cbc or aes\-256\-cbc. By default, aes\-128\-cbc is used. .UNINDENT .INDENT 0.0 .TP .B \-\-tls\-ticket\-key\-memcached\-cert\-file= Path to client certificate for memcached connections to get TLS ticket keys. .UNINDENT .INDENT 0.0 .TP .B \-\-tls\-ticket\-key\-memcached\-private\-key\-file= Path to client private key for memcached connections to get TLS ticket keys. .UNINDENT .INDENT 0.0 .TP .B \-\-fetch\-ocsp\-response\-file= Path to fetch\-ocsp\-response script file. It should be absolute path. .sp Default: \fB/usr/local/share/nghttp2/fetch\-ocsp\-response\fP .UNINDENT .INDENT 0.0 .TP .B \-\-ocsp\-update\-interval= Set interval to update OCSP response cache. .sp Default: \fB4h\fP .UNINDENT .INDENT 0.0 .TP .B \-\-ocsp\-startup Start accepting connections after initial attempts to get OCSP responses finish. It does not matter some of the attempts fail. This feature is useful if OCSP responses must be available before accepting connections. .UNINDENT .INDENT 0.0 .TP .B \-\-no\-verify\-ocsp nghttpx does not verify OCSP response. .UNINDENT .INDENT 0.0 .TP .B \-\-no\-ocsp Disable OCSP stapling. .UNINDENT .INDENT 0.0 .TP .B \-\-tls\-session\-cache\-memcached=,[;tls] Specify address of memcached server to store session cache. This enables shared session cache between multiple nghttpx instances. Optionally, memcached connection can be encrypted with TLS by specifying \(dqtls\(dq parameter. .UNINDENT .INDENT 0.0 .TP .B \-\-tls\-session\-cache\-memcached\-address\-family=(auto|IPv4|IPv6) Specify address family of memcached connections to store session cache. If \(dqauto\(dq is given, both IPv4 and IPv6 are considered. If \(dqIPv4\(dq is given, only IPv4 address is considered. If \(dqIPv6\(dq is given, only IPv6 address is considered. .sp Default: \fBauto\fP .UNINDENT .INDENT 0.0 .TP .B \-\-tls\-session\-cache\-memcached\-cert\-file= Path to client certificate for memcached connections to store session cache. .UNINDENT .INDENT 0.0 .TP .B \-\-tls\-session\-cache\-memcached\-private\-key\-file= Path to client private key for memcached connections to store session cache. .UNINDENT .INDENT 0.0 .TP .B \-\-tls\-dyn\-rec\-warmup\-threshold= Specify the threshold size for TLS dynamic record size behaviour. During a TLS session, after the threshold number of bytes have been written, the TLS record size will be increased to the maximum allowed (16K). The max record size will continue to be used on the active TLS session. After \fI\%\-\-tls\-dyn\-rec\-idle\-timeout\fP has elapsed, the record size is reduced to 1300 bytes. Specify 0 to always use the maximum record size, regardless of idle period. This behaviour applies to all TLS based frontends, and TLS HTTP/2 backends. .sp Default: \fB1M\fP .UNINDENT .INDENT 0.0 .TP .B \-\-tls\-dyn\-rec\-idle\-timeout= Specify TLS dynamic record size behaviour timeout. See \fI\%\-\-tls\-dyn\-rec\-warmup\-threshold\fP for more information. This behaviour applies to all TLS based frontends, and TLS HTTP/2 backends. .sp Default: \fB1s\fP .UNINDENT .INDENT 0.0 .TP .B \-\-no\-http2\-cipher\-block\-list Allow block listed cipher suite on frontend HTTP/2 connection. See \fI\%https://tools.ietf.org/html/rfc7540#appendix\-A\fP for the complete HTTP/2 cipher suites block list. .UNINDENT .INDENT 0.0 .TP .B \-\-client\-no\-http2\-cipher\-block\-list Allow block listed cipher suite on backend HTTP/2 connection. See \fI\%https://tools.ietf.org/html/rfc7540#appendix\-A\fP for the complete HTTP/2 cipher suites block list. .UNINDENT .INDENT 0.0 .TP .B \-\-tls\-sct\-dir= Specifies the directory where *.sct files exist. All *.sct files in are read, and sent as extension_data of TLS signed_certificate_timestamp (RFC 6962) to client. These *.sct files are for the certificate specified in positional command\-line argument , or certificate option in configuration file. For additional certificates, use \fI\%\-\-subcert\fP option. This option requires OpenSSL >= 1.0.2. .UNINDENT .INDENT 0.0 .TP .B \-\-psk\-secrets= Read list of PSK identity and secrets from . This is used for frontend connection. The each line of input file is formatted as :, where is PSK identity, and is secret in hex. An empty line, and line which starts with \(aq#\(aq are skipped. The default enabled cipher list might not contain any PSK cipher suite. In that case, desired PSK cipher suites must be enabled using \fI\%\-\-ciphers\fP option. The desired PSK cipher suite may be block listed by HTTP/2. To use those cipher suites with HTTP/2, consider to use \fI\%\-\-no\-http2\-cipher\-block\-list\fP option. But be aware its implications. .UNINDENT .INDENT 0.0 .TP .B \-\-client\-psk\-secrets= Read PSK identity and secrets from . This is used for backend connection. The each line of input file is formatted as :, where is PSK identity, and is secret in hex. An empty line, and line which starts with \(aq#\(aq are skipped. The first identity and secret pair encountered is used. The default enabled cipher list might not contain any PSK cipher suite. In that case, desired PSK cipher suites must be enabled using \fI\%\-\-client\-ciphers\fP option. The desired PSK cipher suite may be block listed by HTTP/2. To use those cipher suites with HTTP/2, consider to use \fI\%\-\-client\-no\-http2\-cipher\-block\-list\fP option. But be aware its implications. .UNINDENT .INDENT 0.0 .TP .B \-\-tls\-no\-postpone\-early\-data By default, except for QUIC connections, nghttpx postpones forwarding HTTP requests sent in early data, including those sent in partially in it, until TLS handshake finishes. If all backend server recognizes \(dqEarly\-Data\(dq header field, using this option makes nghttpx not postpone forwarding request and get full potential of 0\-RTT data. .UNINDENT .INDENT 0.0 .TP .B \-\-tls\-max\-early\-data= Sets the maximum amount of 0\-RTT data that server accepts. .sp Default: \fB16K\fP .UNINDENT .INDENT 0.0 .TP .B \-\-tls\-ktls Enable ktls. For server, ktls is enable if \fI\%\-\-tls\-session\-cache\-memcached\fP is not configured. .UNINDENT .SS HTTP/2 .INDENT 0.0 .TP .B \-c, \-\-frontend\-http2\-max\-concurrent\-streams= Set the maximum number of the concurrent streams in one frontend HTTP/2 session. .sp Default: \fB100\fP .UNINDENT .INDENT 0.0 .TP .B \-\-backend\-http2\-max\-concurrent\-streams= Set the maximum number of the concurrent streams in one backend HTTP/2 session. This sets maximum number of concurrent opened pushed streams. The maximum number of concurrent requests are set by a remote server. .sp Default: \fB100\fP .UNINDENT .INDENT 0.0 .TP .B \-\-frontend\-http2\-window\-size= Sets the per\-stream initial window size of HTTP/2 frontend connection. .sp Default: \fB65535\fP .UNINDENT .INDENT 0.0 .TP .B \-\-frontend\-http2\-connection\-window\-size= Sets the per\-connection window size of HTTP/2 frontend connection. .sp Default: \fB65535\fP .UNINDENT .INDENT 0.0 .TP .B \-\-backend\-http2\-window\-size= Sets the initial window size of HTTP/2 backend connection. .sp Default: \fB65535\fP .UNINDENT .INDENT 0.0 .TP .B \-\-backend\-http2\-connection\-window\-size= Sets the per\-connection window size of HTTP/2 backend connection. .sp Default: \fB2147483647\fP .UNINDENT .INDENT 0.0 .TP .B \-\-http2\-no\-cookie\-crumbling Don\(aqt crumble cookie header field. .UNINDENT .INDENT 0.0 .TP .B \-\-padding= Add at most bytes to a HTTP/2 frame payload as padding. Specify 0 to disable padding. This option is meant for debugging purpose and not intended to enhance protocol security. .UNINDENT .INDENT 0.0 .TP .B \-\-no\-server\-push Disable HTTP/2 server push. Server push is supported by default mode and HTTP/2 frontend via Link header field. It is also supported if both frontend and backend are HTTP/2 in default mode. In this case, server push from backend session is relayed to frontend, and server push via Link header field is also supported. .UNINDENT .INDENT 0.0 .TP .B \-\-frontend\-http2\-optimize\-write\-buffer\-size (Experimental) Enable write buffer size optimization in frontend HTTP/2 TLS connection. This optimization aims to reduce write buffer size so that it only contains bytes which can send immediately. This makes server more responsive to prioritized HTTP/2 stream because the buffering of lower priority stream is reduced. This option is only effective on recent Linux platform. .UNINDENT .INDENT 0.0 .TP .B \-\-frontend\-http2\-optimize\-window\-size (Experimental) Automatically tune connection level window size of frontend HTTP/2 TLS connection. If this feature is enabled, connection window size starts with the default window size, 65535 bytes. nghttpx automatically adjusts connection window size based on TCP receiving window size. The maximum window size is capped by the value specified by \fI\%\-\-frontend\-http2\-connection\-window\-size\fP\&. Since the stream is subject to stream level window size, it should be adjusted using \fI\%\-\-frontend\-http2\-window\-size\fP option as well. This option is only effective on recent Linux platform. .UNINDENT .INDENT 0.0 .TP .B \-\-frontend\-http2\-encoder\-dynamic\-table\-size= Specify the maximum dynamic table size of HPACK encoder in the frontend HTTP/2 connection. The decoder (client) specifies the maximum dynamic table size it accepts. Then the negotiated dynamic table size is the minimum of this option value and the value which client specified. .sp Default: \fB4K\fP .UNINDENT .INDENT 0.0 .TP .B \-\-frontend\-http2\-decoder\-dynamic\-table\-size= Specify the maximum dynamic table size of HPACK decoder in the frontend HTTP/2 connection. .sp Default: \fB4K\fP .UNINDENT .INDENT 0.0 .TP .B \-\-backend\-http2\-encoder\-dynamic\-table\-size= Specify the maximum dynamic table size of HPACK encoder in the backend HTTP/2 connection. The decoder (backend) specifies the maximum dynamic table size it accepts. Then the negotiated dynamic table size is the minimum of this option value and the value which backend specified. .sp Default: \fB4K\fP .UNINDENT .INDENT 0.0 .TP .B \-\-backend\-http2\-decoder\-dynamic\-table\-size= Specify the maximum dynamic table size of HPACK decoder in the backend HTTP/2 connection. .sp Default: \fB4K\fP .UNINDENT .SS Mode .INDENT 0.0 .TP .B (default mode) Accept HTTP/2, and HTTP/1.1 over SSL/TLS. \(dqno\-tls\(dq parameter is used in \fI\%\-\-frontend\fP option, accept HTTP/2 and HTTP/1.1 over cleartext TCP. The incoming HTTP/1.1 connection can be upgraded to HTTP/2 through HTTP Upgrade. .UNINDENT .INDENT 0.0 .TP .B \-s, \-\-http2\-proxy Like default mode, but enable forward proxy. This is so called HTTP/2 proxy mode. .UNINDENT .SS Logging .INDENT 0.0 .TP .B \-L, \-\-log\-level= Set the severity level of log output. must be one of INFO, NOTICE, WARN, ERROR and FATAL. .sp Default: \fBNOTICE\fP .UNINDENT .INDENT 0.0 .TP .B \-\-accesslog\-file= Set path to write access log. To reopen file, send USR1 signal to nghttpx. .UNINDENT .INDENT 0.0 .TP .B \-\-accesslog\-syslog Send access log to syslog. If this option is used, \fI\%\-\-accesslog\-file\fP option is ignored. .UNINDENT .INDENT 0.0 .TP .B \-\-accesslog\-format= Specify format string for access log. The default format is combined format. The following variables are available: .INDENT 7.0 .IP \(bu 2 $remote_addr: client IP address. .IP \(bu 2 $time_local: local time in Common Log format. .IP \(bu 2 $time_iso8601: local time in ISO 8601 format. .IP \(bu 2 $request: HTTP request line. .IP \(bu 2 $status: HTTP response status code. .IP \(bu 2 $body_bytes_sent: the number of bytes sent to client as response body. .IP \(bu 2 $http_: value of HTTP request header where \(aq_\(aq in is replaced with \(aq\-\(aq. .IP \(bu 2 $remote_port: client port. .IP \(bu 2 $server_port: server port. .IP \(bu 2 $request_time: request processing time in seconds with milliseconds resolution. .IP \(bu 2 $pid: PID of the running process. .IP \(bu 2 $alpn: ALPN identifier of the protocol which generates the response. For HTTP/1, ALPN is always http/1.1, regardless of minor version. .IP \(bu 2 $tls_cipher: cipher used for SSL/TLS connection. .IP \(bu 2 $tls_client_fingerprint_sha256: SHA\-256 fingerprint of client certificate. .IP \(bu 2 $tls_client_fingerprint_sha1: SHA\-1 fingerprint of client certificate. .IP \(bu 2 $tls_client_subject_name: subject name in client certificate. .IP \(bu 2 $tls_client_issuer_name: issuer name in client certificate. .IP \(bu 2 $tls_client_serial: serial number in client certificate. .IP \(bu 2 $tls_protocol: protocol for SSL/TLS connection. .IP \(bu 2 $tls_session_id: session ID for SSL/TLS connection. .IP \(bu 2 $tls_session_reused: \(dqr\(dq if SSL/TLS session was reused. Otherwise, \(dq.\(dq .IP \(bu 2 $tls_sni: SNI server name for SSL/TLS connection. .IP \(bu 2 $backend_host: backend host used to fulfill the request. \(dq\-\(dq if backend host is not available. .IP \(bu 2 $backend_port: backend port used to fulfill the request. \(dq\-\(dq if backend host is not available. .IP \(bu 2 $method: HTTP method .IP \(bu 2 $path: Request path including query. For CONNECT request, authority is recorded. .IP \(bu 2 $path_without_query: $path up to the first \(aq?\(aq character. For CONNECT request, authority is recorded. .IP \(bu 2 $protocol_version: HTTP version (e.g., HTTP/1.1, HTTP/2) .UNINDENT .sp The variable can be enclosed by \(dq{\(dq and \(dq}\(dq for disambiguation (e.g., ${remote_addr}). .sp Default: \fB$remote_addr \- \- [$time_local] \(dq$request\(dq $status $body_bytes_sent \(dq$http_referer\(dq \(dq$http_user_agent\(dq\fP .UNINDENT .INDENT 0.0 .TP .B \-\-accesslog\-write\-early Write access log when response header fields are received from backend rather than when request transaction finishes. .UNINDENT .INDENT 0.0 .TP .B \-\-errorlog\-file= Set path to write error log. To reopen file, send USR1 signal to nghttpx. stderr will be redirected to the error log file unless \fI\%\-\-errorlog\-syslog\fP is used. .sp Default: \fB/dev/stderr\fP .UNINDENT .INDENT 0.0 .TP .B \-\-errorlog\-syslog Send error log to syslog. If this option is used, \fI\%\-\-errorlog\-file\fP option is ignored. .UNINDENT .INDENT 0.0 .TP .B \-\-syslog\-facility= Set syslog facility to . .sp Default: \fBdaemon\fP .UNINDENT .SS HTTP .INDENT 0.0 .TP .B \-\-add\-x\-forwarded\-for Append X\-Forwarded\-For header field to the downstream request. .UNINDENT .INDENT 0.0 .TP .B \-\-strip\-incoming\-x\-forwarded\-for Strip X\-Forwarded\-For header field from inbound client requests. .UNINDENT .INDENT 0.0 .TP .B \-\-no\-add\-x\-forwarded\-proto Don\(aqt append additional X\-Forwarded\-Proto header field to the backend request. If inbound client sets X\-Forwarded\-Proto, and \fI\%\-\-no\-strip\-incoming\-x\-forwarded\-proto\fP option is used, they are passed to the backend. .UNINDENT .INDENT 0.0 .TP .B \-\-no\-strip\-incoming\-x\-forwarded\-proto Don\(aqt strip X\-Forwarded\-Proto header field from inbound client requests. .UNINDENT .INDENT 0.0 .TP .B \-\-add\-forwarded= Append RFC 7239 Forwarded header field with parameters specified in comma delimited list . The supported parameters are \(dqby\(dq, \(dqfor\(dq, \(dqhost\(dq, and \(dqproto\(dq. By default, the value of \(dqby\(dq and \(dqfor\(dq parameters are obfuscated string. See \fI\%\-\-forwarded\-by\fP and \fI\%\-\-forwarded\-for\fP options respectively. Note that nghttpx does not translate non\-standard X\-Forwarded\-* header fields into Forwarded header field, and vice versa. .UNINDENT .INDENT 0.0 .TP .B \-\-strip\-incoming\-forwarded Strip Forwarded header field from inbound client requests. .UNINDENT .INDENT 0.0 .TP .B \-\-forwarded\-by=(obfuscated|ip|) Specify the parameter value sent out with \(dqby\(dq parameter of Forwarded header field. If \(dqobfuscated\(dq is given, the string is randomly generated at startup. If \(dqip\(dq is given, the interface address of the connection, including port number, is sent with \(dqby\(dq parameter. In case of UNIX domain socket, \(dqlocalhost\(dq is used instead of address and port. User can also specify the static obfuscated string. The limitation is that it must start with \(dq_\(dq, and only consists of character set [A\-Za\-z0\-9._\-], as described in RFC 7239. .sp Default: \fBobfuscated\fP .UNINDENT .INDENT 0.0 .TP .B \-\-forwarded\-for=(obfuscated|ip) Specify the parameter value sent out with \(dqfor\(dq parameter of Forwarded header field. If \(dqobfuscated\(dq is given, the string is randomly generated for each client connection. If \(dqip\(dq is given, the remote client address of the connection, without port number, is sent with \(dqfor\(dq parameter. In case of UNIX domain socket, \(dqlocalhost\(dq is used instead of address. .sp Default: \fBobfuscated\fP .UNINDENT .INDENT 0.0 .TP .B \-\-no\-via Don\(aqt append to Via header field. If Via header field is received, it is left unaltered. .UNINDENT .INDENT 0.0 .TP .B \-\-no\-strip\-incoming\-early\-data Don\(aqt strip Early\-Data header field from inbound client requests. .UNINDENT .INDENT 0.0 .TP .B \-\-no\-location\-rewrite Don\(aqt rewrite location header field in default mode. When \fI\%\-\-http2\-proxy\fP is used, location header field will not be altered regardless of this option. .UNINDENT .INDENT 0.0 .TP .B \-\-host\-rewrite Rewrite host and :authority header fields in default mode. When \fI\%\-\-http2\-proxy\fP is used, these headers will not be altered regardless of this option. .UNINDENT .INDENT 0.0 .TP .B \-\-altsvc= Specify protocol ID, port, host and origin of alternative service. , and are optional. Empty and are allowed and they are treated as nothing is specified. They are advertised in alt\-svc header field only in HTTP/1.1 frontend. This option can be used multiple times to specify multiple alternative services. Example: \fI\%\-\-altsvc\fP=\(dqh2,443,,,ma=3600; persist=1\(dq .UNINDENT .INDENT 0.0 .TP .B \-\-http2\-altsvc= Just like \fI\%\-\-altsvc\fP option, but this altsvc is only sent in HTTP/2 frontend. .UNINDENT .INDENT 0.0 .TP .B \-\-add\-request\-header=
Specify additional header field to add to request header set. The field name must be lowercase. This option just appends header field and won\(aqt replace anything already set. This option can be used several times to specify multiple header fields. Example: \fI\%\-\-add\-request\-header\fP=\(dqfoo: bar\(dq .UNINDENT .INDENT 0.0 .TP .B \-\-add\-response\-header=
Specify additional header field to add to response header set. The field name must be lowercase. This option just appends header field and won\(aqt replace anything already set. This option can be used several times to specify multiple header fields. Example: \fI\%\-\-add\-response\-header\fP=\(dqfoo: bar\(dq .UNINDENT .INDENT 0.0 .TP .B \-\-request\-header\-field\-buffer= Set maximum buffer size for incoming HTTP request header field list. This is the sum of header name and value in bytes. If trailer fields exist, they are counted towards this number. .sp Default: \fB64K\fP .UNINDENT .INDENT 0.0 .TP .B \-\-max\-request\-header\-fields= Set maximum number of incoming HTTP request header fields. If trailer fields exist, they are counted towards this number. .sp Default: \fB100\fP .UNINDENT .INDENT 0.0 .TP .B \-\-response\-header\-field\-buffer= Set maximum buffer size for incoming HTTP response header field list. This is the sum of header name and value in bytes. If trailer fields exist, they are counted towards this number. .sp Default: \fB64K\fP .UNINDENT .INDENT 0.0 .TP .B \-\-max\-response\-header\-fields= Set maximum number of incoming HTTP response header fields. If trailer fields exist, they are counted towards this number. .sp Default: \fB500\fP .UNINDENT .INDENT 0.0 .TP .B \-\-error\-page=(|*)= Set file path to custom error page served when nghttpx originally generates HTTP error status code . must be greater than or equal to 400, and at most 599. If \(dq*\(dq is used instead of , it matches all HTTP status code. If error status code comes from backend server, the custom error pages are not used. .UNINDENT .INDENT 0.0 .TP .B \-\-server\-name= Change server response header field value to . .sp Default: \fBnghttpx\fP .UNINDENT .INDENT 0.0 .TP .B \-\-no\-server\-rewrite Don\(aqt rewrite server header field in default mode. When \fI\%\-\-http2\-proxy\fP is used, these headers will not be altered regardless of this option. .UNINDENT .INDENT 0.0 .TP .B \-\-redirect\-https\-port= Specify the port number which appears in Location header field when redirect to HTTPS URI is made due to \(dqredirect\-if\-not\-tls\(dq parameter in \fI\%\-\-backend\fP option. .sp Default: \fB443\fP .UNINDENT .INDENT 0.0 .TP .B \-\-require\-http\-scheme Always require http or https scheme in HTTP request. It also requires that https scheme must be used for an encrypted connection. Otherwise, http scheme must be used. This option is recommended for a server deployment which directly faces clients and the services it provides only require http or https scheme. .UNINDENT .SS API .INDENT 0.0 .TP .B \-\-api\-max\-request\-body= Set the maximum size of request body for API request. .sp Default: \fB32M\fP .UNINDENT .SS DNS .INDENT 0.0 .TP .B \-\-dns\-cache\-timeout= Set duration that cached DNS results remain valid. Note that nghttpx caches the unsuccessful results as well. .sp Default: \fB10s\fP .UNINDENT .INDENT 0.0 .TP .B \-\-dns\-lookup\-timeout= Set timeout that DNS server is given to respond to the initial DNS query. For the 2nd and later queries, server is given time based on this timeout, and it is scaled linearly. .sp Default: \fB5s\fP .UNINDENT .INDENT 0.0 .TP .B \-\-dns\-max\-try= Set the number of DNS query before nghttpx gives up name lookup. .sp Default: \fB2\fP .UNINDENT .INDENT 0.0 .TP .B \-\-frontend\-max\-requests= The number of requests that single frontend connection can process. For HTTP/2, this is the number of streams in one HTTP/2 connection. For HTTP/1, this is the number of keep alive requests. This is hint to nghttpx, and it may allow additional few requests. The default value is unlimited. .UNINDENT .SS Debug .INDENT 0.0 .TP .B \-\-frontend\-http2\-dump\-request\-header= Dumps request headers received by HTTP/2 frontend to the file denoted in . The output is done in HTTP/1 header field format and each header block is followed by an empty line. This option is not thread safe and MUST NOT be used with option \fI\%\-n\fP, where >= 2. .UNINDENT .INDENT 0.0 .TP .B \-\-frontend\-http2\-dump\-response\-header= Dumps response headers sent from HTTP/2 frontend to the file denoted in . The output is done in HTTP/1 header field format and each header block is followed by an empty line. This option is not thread safe and MUST NOT be used with option \fI\%\-n\fP, where >= 2. .UNINDENT .INDENT 0.0 .TP .B \-o, \-\-frontend\-frame\-debug Print HTTP/2 frames in frontend to stderr. This option is not thread safe and MUST NOT be used with option \fI\%\-n\fP=N, where N >= 2. .UNINDENT .SS Process .INDENT 0.0 .TP .B \-D, \-\-daemon Run in a background. If \fI\%\-D\fP is used, the current working directory is changed to \(aq\fI/\fP\(aq. .UNINDENT .INDENT 0.0 .TP .B \-\-pid\-file= Set path to save PID of this program. .UNINDENT .INDENT 0.0 .TP .B \-\-user= Run this program as . This option is intended to be used to drop root privileges. .UNINDENT .INDENT 0.0 .TP .B \-\-single\-process Run this program in a single process mode for debugging purpose. Without this option, nghttpx creates at least 2 processes: main and worker processes. If this option is used, main and worker are unified into a single process. nghttpx still spawns additional process if neverbleed is used. In the single process mode, the signal handling feature is disabled. .UNINDENT .INDENT 0.0 .TP .B \-\-max\-worker\-processes= The maximum number of worker processes. nghttpx spawns new worker process when it reloads its configuration. The previous worker process enters graceful termination period and will terminate when it finishes handling the existing connections. However, if reloading configurations happen very frequently, the worker processes might be piled up if they take a bit long time to finish the existing connections. With this option, if the number of worker processes exceeds the given value, the oldest worker process is terminated immediately. Specifying 0 means no limit and it is the default behaviour. .UNINDENT .INDENT 0.0 .TP .B \-\-worker\-process\-grace\-shutdown\-period= Maximum period for a worker process to terminate gracefully. When a worker process enters in graceful shutdown period (e.g., when nghttpx reloads its configuration) and it does not finish handling the existing connections in the given period of time, it is immediately terminated. Specifying 0 means no limit and it is the default behaviour. .UNINDENT .SS Scripting .INDENT 0.0 .TP .B \-\-mruby\-file= Set mruby script file .UNINDENT .INDENT 0.0 .TP .B \-\-ignore\-per\-pattern\-mruby\-error Ignore mruby compile error for per\-pattern mruby script file. If error occurred, it is treated as if no mruby file were specified for the pattern. .UNINDENT .SS HTTP/3 and QUIC .INDENT 0.0 .TP .B \-\-frontend\-quic\-idle\-timeout= Specify an idle timeout for QUIC connection. .sp Default: \fB30s\fP .UNINDENT .INDENT 0.0 .TP .B \-\-frontend\-quic\-debug\-log Output QUIC debug log to \fI/dev/stderr.\fP .UNINDENT .INDENT 0.0 .TP .B \-\-quic\-bpf\-program\-file= Specify a path to eBPF program file reuseport_kern.o to direct an incoming QUIC UDP datagram to a correct socket. .sp Default: \fB/usr/local/lib/nghttp2/reuseport_kern.o\fP .UNINDENT .INDENT 0.0 .TP .B \-\-frontend\-quic\-early\-data Enable early data on frontend QUIC connections. nghttpx sends \(dqEarly\-Data\(dq header field to a backend server if a request is received in early data and handshake has not finished. All backend servers should deal with possibly replayed requests. .UNINDENT .INDENT 0.0 .TP .B \-\-frontend\-quic\-qlog\-dir= Specify a directory where a qlog file is written for frontend QUIC connections. A qlog file is created per each QUIC connection. The file name is ISO8601 basic format, followed by \(dq\-\(dq, server Source Connection ID and \(dq.sqlog\(dq. .UNINDENT .INDENT 0.0 .TP .B \-\-frontend\-quic\-require\-token Require an address validation token for a frontend QUIC connection. Server sends a token in Retry packet or NEW_TOKEN frame in the previous connection. .UNINDENT .INDENT 0.0 .TP .B \-\-frontend\-quic\-congestion\-controller= Specify a congestion controller algorithm for a frontend QUIC connection. should be either \(dqcubic\(dq or \(dqbbr\(dq. .sp Default: \fBcubic\fP .UNINDENT .INDENT 0.0 .TP .B \-\-frontend\-quic\-secret\-file= Path to file that contains secure random data to be used as QUIC keying materials. It is used to derive keys for encrypting tokens and Connection IDs. It is not used to encrypt QUIC packets. Each line of this file must contain exactly 136 bytes hex\-encoded string (when decoded the byte string is 68 bytes long). The first 3 bits of decoded byte string are used to identify the keying material. An empty line or a line which starts \(aq#\(aq is ignored. The file can contain more than one keying materials. Because the identifier is 3 bits, at most 8 keying materials are read and the remaining data is discarded. The first keying material in the file is primarily used for encryption and decryption for new connection. The other ones are used to decrypt data for the existing connections. Specifying multiple keying materials enables key rotation. Please note that key rotation does not occur automatically. User should update files or change options values and restart nghttpx gracefully. If opening or reading given file fails, all loaded keying materials are discarded and it is treated as if none of this option is given. If this option is not given or an error occurred while opening or reading a file, a keying material is generated internally on startup and reload. .UNINDENT .INDENT 0.0 .TP .B \-\-quic\-server\-id= Specify server ID encoded in Connection ID to identify this particular server instance. Connection ID is encrypted and this part is not visible in public. It must be 4 bytes long and must be encoded in hex string (which is 8 bytes long). If this option is omitted, a random server ID is generated on startup and configuration reload. .UNINDENT .INDENT 0.0 .TP .B \-\-frontend\-quic\-initial\-rtt= Specify the initial RTT of the frontend QUIC connection. .sp Default: \fB333ms\fP .UNINDENT .INDENT 0.0 .TP .B \-\-no\-quic\-bpf Disable eBPF. .UNINDENT .INDENT 0.0 .TP .B \-\-frontend\-http3\-window\-size= Sets the per\-stream initial window size of HTTP/3 frontend connection. .sp Default: \fB256K\fP .UNINDENT .INDENT 0.0 .TP .B \-\-frontend\-http3\-connection\-window\-size= Sets the per\-connection window size of HTTP/3 frontend connection. .sp Default: \fB1M\fP .UNINDENT .INDENT 0.0 .TP .B \-\-frontend\-http3\-max\-window\-size= Sets the maximum per\-stream window size of HTTP/3 frontend connection. The window size is adjusted based on the receiving rate of stream data. The initial value is the value specified by \fI\%\-\-frontend\-http3\-window\-size\fP and the window size grows up to bytes. .sp Default: \fB6M\fP .UNINDENT .INDENT 0.0 .TP .B \-\-frontend\-http3\-max\-connection\-window\-size= Sets the maximum per\-connection window size of HTTP/3 frontend connection. The window size is adjusted based on the receiving rate of stream data. The initial value is the value specified by \fI\%\-\-frontend\-http3\-connection\-window\-size\fP and the window size grows up to bytes. .sp Default: \fB8M\fP .UNINDENT .INDENT 0.0 .TP .B \-\-frontend\-http3\-max\-concurrent\-streams= Set the maximum number of the concurrent streams in one frontend HTTP/3 connection. .sp Default: \fB100\fP .UNINDENT .SS Misc .INDENT 0.0 .TP .B \-\-conf= Load configuration from . Please note that nghttpx always tries to read the default configuration file if \fI\%\-\-conf\fP is not given. .sp Default: \fB/etc/nghttpx/nghttpx.conf\fP .UNINDENT .INDENT 0.0 .TP .B \-\-include= Load additional configurations from . File is read when configuration parser encountered this option. This option can be used multiple times, or even recursively. .UNINDENT .INDENT 0.0 .TP .B \-v, \-\-version Print version and exit. .UNINDENT .INDENT 0.0 .TP .B \-h, \-\-help Print this help and exit. .UNINDENT .sp The argument is an integer and an optional unit (e.g., 10K is 10 * 1024). Units are K, M and G (powers of 1024). .sp The argument is an integer and an optional unit (e.g., 1s is 1 second and 500ms is 500 milliseconds). Units are h, m, s or ms (hours, minutes, seconds and milliseconds, respectively). If a unit is omitted, a second is used as unit. .SH FILES .INDENT 0.0 .TP .B \fI/etc/nghttpx/nghttpx.conf\fP The default configuration file path nghttpx searches at startup. The configuration file path can be changed using \fI\%\-\-conf\fP option. .sp Those lines which are staring \fB#\fP are treated as comment. .sp The option name in the configuration file is the long command\-line option name with leading \fB\-\-\fP stripped (e.g., \fBfrontend\fP). Put \fB=\fP between option name and value. Don\(aqt put extra leading or trailing spaces. .sp When specifying arguments including characters which have special meaning to a shell, we usually use quotes so that shell does not interpret them. When writing this configuration file, quotes for this purpose must not be used. For example, specify additional request header field, do this: .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C add\-request\-header=foo: bar .ft P .fi .UNINDENT .UNINDENT .sp instead of: .INDENT 7.0 .INDENT 3.5 .sp .nf .ft C add\-request\-header=\(dqfoo: bar\(dq .ft P .fi .UNINDENT .UNINDENT .sp The options which do not take argument in the command\-line \fItake\fP argument in the configuration file. Specify \fByes\fP as an argument (e.g., \fBhttp2\-proxy=yes\fP). If other string is given, it is ignored. .sp To specify private key and certificate file which are given as positional arguments in command\-line, use \fBprivate\-key\-file\fP and \fBcertificate\-file\fP\&. .sp \fI\%\-\-conf\fP option cannot be used in the configuration file and will be ignored if specified. .TP .B Error log Error log is written to stderr by default. It can be configured using \fI\%\-\-errorlog\-file\fP\&. The format of log message is as follows: .sp (:) .INDENT 7.0 .TP .B It is a combination of date and time when the log is written. It is in ISO 8601 format. .TP .B It is a main process ID. .TP .B It is a process ID which writes this log. .TP .B It is a thread ID which writes this log. It would be unique within . .TP .B and They are source file name, and line number which produce this log. .TP .B It is a log message body. .UNINDENT .UNINDENT .SH SIGNALS .INDENT 0.0 .TP .B SIGQUIT Shutdown gracefully. First accept pending connections and stop accepting connection. After all connections are handled, nghttpx exits. .TP .B SIGHUP Reload configuration file given in \fI\%\-\-conf\fP\&. .TP .B SIGUSR1 Reopen log files. .UNINDENT .sp SIGUSR2 .INDENT 0.0 .INDENT 3.5 Fork and execute nghttpx. It will execute the binary in the same path with same command\-line arguments and environment variables. As of nghttpx version 1.20.0, the new main process sends SIGQUIT to the original main process when it is ready to serve requests. For the earlier versions of nghttpx, user has to send SIGQUIT to the original main process. .sp The difference between SIGUSR2 (+ SIGQUIT) and SIGHUP is that former is usually used to execute new binary, and the main process is newly spawned. On the other hand, the latter just reloads configuration file, and the same main process continues to exist. .UNINDENT .UNINDENT .sp \fBNOTE:\fP .INDENT 0.0 .INDENT 3.5 nghttpx consists of multiple processes: one process for processing these signals, and another one for processing requests. The former spawns the latter. The former is called main process, and the latter is called worker process. If neverbleed is enabled, the worker process spawns neverbleed daemon process which does RSA key processing. The above signal must be sent to the main process. If the other processes received one of them, it is ignored. This behaviour of these processes may change in the future release. In other words, in the future release, the processes other than main process may terminate upon the reception of these signals. Therefore these signals should not be sent to the processes other than main process. .UNINDENT .UNINDENT .SH SERVER PUSH .sp nghttpx supports HTTP/2 server push in default mode with Link header field. nghttpx looks for Link header field (\fI\%RFC 5988\fP) in response headers from backend server and extracts URI\-reference with parameter \fBrel=preload\fP (see \fI\%preload\fP) and pushes those URIs to the frontend client. Here is a sample Link header field to initiate server push: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C Link: ; rel=preload Link: ; rel=preload .ft P .fi .UNINDENT .UNINDENT .sp Currently, the following restriction is applied for server push: .INDENT 0.0 .IP 1. 3 The associated stream must have method \(dqGET\(dq or \(dqPOST\(dq. The associated stream\(aqs status code must be 200. .UNINDENT .sp This limitation may be loosened in the future release. .sp nghttpx also supports server push if both frontend and backend are HTTP/2 in default mode. In this case, in addition to server push via Link header field, server push from backend is forwarded to frontend HTTP/2 session. .sp HTTP/2 server push will be disabled if \fI\%\-\-http2\-proxy\fP is used. .SH UNIX DOMAIN SOCKET .sp nghttpx supports UNIX domain socket with a filename for both frontend and backend connections. .sp Please note that current nghttpx implementation does not delete a socket with a filename. And on start up, if nghttpx detects that the specified socket already exists in the file system, nghttpx first deletes it. However, if SIGUSR2 is used to execute new binary and both old and new configurations use same filename, new binary does not delete the socket and continues to use it. .SH OCSP STAPLING .sp OCSP query is done using external Python script \fBfetch\-ocsp\-response\fP, which has been originally developed in Perl as part of h2o project (\fI\%https://github.com/h2o/h2o\fP), and was translated into Python. .sp The script file is usually installed under \fB$(prefix)/share/nghttp2/\fP directory. The actual path to script can be customized using \fI\%\-\-fetch\-ocsp\-response\-file\fP option. .sp If OCSP query is failed, previous OCSP response, if any, is continued to be used. .sp \fI\%\-\-fetch\-ocsp\-response\-file\fP option provides wide range of possibility to manage OCSP response. It can take an arbitrary script or executable. The requirement is that it supports the command\-line interface of \fBfetch\-ocsp\-response\fP script, and it must return a valid DER encoded OCSP response on success. It must return exit code 0 on success, and 75 for temporary error, and the other error code for generic failure. For large cluster of servers, it is not efficient for each server to perform OCSP query using \fBfetch\-ocsp\-response\fP\&. Instead, you can retrieve OCSP response in some way, and store it in a disk or a shared database. Then specify a program in \fI\%\-\-fetch\-ocsp\-response\-file\fP to fetch it from those stores. This could provide a way to share the OCSP response between fleet of servers, and also any OCSP query strategy can be applied which may be beyond the ability of nghttpx itself or \fBfetch\-ocsp\-response\fP script. .SH TLS SESSION RESUMPTION .sp nghttpx supports TLS session resumption through both session ID and session ticket. .SS SESSION ID RESUMPTION .sp By default, session ID is shared by all worker threads. .sp If \fI\%\-\-tls\-session\-cache\-memcached\fP is given, nghttpx will insert serialized session data to memcached with \fBnghttpx:tls\-session\-cache:\fP + lowercase hex string of session ID as a memcached entry key, with expiry time 12 hours. Session timeout is set to 12 hours. .sp By default, connections to memcached server are not encrypted. To enable encryption, use \fBtls\fP keyword in \fI\%\-\-tls\-session\-cache\-memcached\fP option. .SS TLS SESSION TICKET RESUMPTION .sp By default, session ticket is shared by all worker threads. The automatic key rotation is also enabled by default. Every an hour, new encryption key is generated, and previous encryption key becomes decryption only key. We set session timeout to 12 hours, and thus we keep at most 12 keys. .sp If \fI\%\-\-tls\-ticket\-key\-memcached\fP is given, encryption keys are retrieved from memcached. nghttpx just reads keys from memcached; one has to deploy key generator program to update keys frequently (e.g., every 1 hour). The example key generator tlsticketupdate.go is available under contrib directory in nghttp2 archive. The memcached entry key is \fBnghttpx:tls\-ticket\-key\fP\&. The data format stored in memcached is the binary format described below: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C +\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ | VERSION (4) |LEN (2)|KEY(48 or 80) ... +\-\-\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ ^ | | | +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ (LEN, KEY) pair can be repeated .ft P .fi .UNINDENT .UNINDENT .sp All numbers in the above figure is bytes. All integer fields are network byte order. .sp First 4 bytes integer VERSION field, which must be 1. The 2 bytes integer LEN field gives the length of following KEY field, which contains key. If \fI\%\-\-tls\-ticket\-key\-cipher\fP=aes\-128\-cbc is used, LEN must be 48. If \fI\%\-\-tls\-ticket\-key\-cipher\fP=aes\-256\-cbc is used, LEN must be 80. LEN and KEY pair can be repeated multiple times to store multiple keys. The key appeared first is used as encryption key. All the remaining keys are used as decryption only. .sp By default, connections to memcached server are not encrypted. To enable encryption, use \fBtls\fP keyword in \fI\%\-\-tls\-ticket\-key\-memcached\fP option. .sp If \fI\%\-\-tls\-ticket\-key\-file\fP is given, encryption key is read from the given file. In this case, nghttpx does not rotate key automatically. To rotate key, one has to restart nghttpx (see SIGNALS). .SH CERTIFICATE TRANSPARENCY .sp nghttpx supports TLS \fBsigned_certificate_timestamp\fP extension (\fI\%RFC 6962\fP). The relevant options are \fI\%\-\-tls\-sct\-dir\fP and \fBsct\-dir\fP parameter in \fI\%\-\-subcert\fP\&. They takes a directory, and nghttpx reads all files whose extension is \fB\&.sct\fP under the directory. The \fB*.sct\fP files are encoded as \fBSignedCertificateTimestamp\fP struct described in \fI\%section 3.2 of RFC 69662\fP\&. This format is the same one used by \fI\%nginx\-ct\fP and \fI\%mod_ssl_ct\fP\&. \fI\%ct\-submit\fP can be used to submit certificates to log servers, and obtain the \fBSignedCertificateTimestamp\fP struct which can be used with nghttpx. .SH MRUBY SCRIPTING .sp \fBWARNING:\fP .INDENT 0.0 .INDENT 3.5 The current mruby extension API is experimental and not frozen. The API is subject to change in the future release. .UNINDENT .UNINDENT .sp \fBWARNING:\fP .INDENT 0.0 .INDENT 3.5 Almost all string value returned from method, or attribute is a fresh new mruby string, which involves memory allocation, and copies. Therefore, it is strongly recommended to store a return value in a local variable, and use it, instead of calling method or accessing attribute repeatedly. .UNINDENT .UNINDENT .sp nghttpx allows users to extend its capability using mruby scripts. nghttpx has 2 hook points to execute mruby script: request phase and response phase. The request phase hook is invoked after all request header fields are received from client. The response phase hook is invoked after all response header fields are received from backend server. These hooks allows users to modify header fields, or common HTTP variables, like authority or request path, and even return custom response without forwarding request to backend servers. .sp There are 2 levels of mruby script invocations: global and per\-pattern. The global mruby script is set by \fI\%\-\-mruby\-file\fP option and is called for all requests. The per\-pattern mruby script is set by \(dqmruby\(dq parameter in \fI\%\-b\fP option. It is invoked for a request which matches the particular pattern. The order of hook invocation is: global request phase hook, per\-pattern request phase hook, per\-pattern response phase hook, and finally global response phase hook. If a hook returns a response, any later hooks are not invoked. The global request hook is invoked before the pattern matching is made and changing request path may affect the pattern matching. .sp Please note that request and response hooks of per\-pattern mruby script for a single request might not come from the same script. This might happen after a request hook is executed, backend failed for some reason, and at the same time, backend configuration is replaced by API request, and then the request uses new configuration on retry. The response hook from new configuration, if it is specified, will be invoked. .sp The all mruby script will be evaluated once per thread on startup, and it must instantiate object and evaluate it as the return value (e.g., \fBApp.new\fP). This object is called app object. If app object defines \fBon_req\fP method, it is called with \fI\%Nghttpx::Env\fP object on request hook. Similarly, if app object defines \fBon_resp\fP method, it is called with \fI\%Nghttpx::Env\fP object on response hook. For each method invocation, user can can access \fI\%Nghttpx::Request\fP and \fI\%Nghttpx::Response\fP objects via \fI\%Nghttpx::Env#req\fP and \fI\%Nghttpx::Env#resp\fP respectively. .INDENT 0.0 .TP .B Nghttpx::REQUEST_PHASE Constant to represent request phase. .UNINDENT .INDENT 0.0 .TP .B Nghttpx::RESPONSE_PHASE Constant to represent response phase. .UNINDENT .INDENT 0.0 .TP .B class Nghttpx::Env Object to represent current request specific context. .INDENT 7.0 .TP .B attribute [R] req Return \fI\%Request\fP object. .UNINDENT .INDENT 7.0 .TP .B attribute [R] resp Return \fI\%Response\fP object. .UNINDENT .INDENT 7.0 .TP .B attribute [R] ctx Return Ruby hash object. It persists until request finishes. So values set in request phase hook can be retrieved in response phase hook. .UNINDENT .INDENT 7.0 .TP .B attribute [R] phase Return the current phase. .UNINDENT .INDENT 7.0 .TP .B attribute [R] remote_addr Return IP address of a remote client. If connection is made via UNIX domain socket, this returns the string \(dqlocalhost\(dq. .UNINDENT .INDENT 7.0 .TP .B attribute [R] server_addr Return address of server that accepted the connection. This is a string which specified in \fI\%\-\-frontend\fP option, excluding port number, and not a resolved IP address. For UNIX domain socket, this is a path to UNIX domain socket. .UNINDENT .INDENT 7.0 .TP .B attribute [R] server_port Return port number of the server frontend which accepted the connection from client. .UNINDENT .INDENT 7.0 .TP .B attribute [R] tls_used Return true if TLS is used on the connection. .UNINDENT .INDENT 7.0 .TP .B attribute [R] tls_sni Return the TLS SNI value which client sent in this connection. .UNINDENT .INDENT 7.0 .TP .B attribute [R] tls_client_fingerprint_sha256 Return the SHA\-256 fingerprint of a client certificate. .UNINDENT .INDENT 7.0 .TP .B attribute [R] tls_client_fingerprint_sha1 Return the SHA\-1 fingerprint of a client certificate. .UNINDENT .INDENT 7.0 .TP .B attribute [R] tls_client_issuer_name Return the issuer name of a client certificate. .UNINDENT .INDENT 7.0 .TP .B attribute [R] tls_client_subject_name Return the subject name of a client certificate. .UNINDENT .INDENT 7.0 .TP .B attribute [R] tls_client_serial Return the serial number of a client certificate. .UNINDENT .INDENT 7.0 .TP .B attribute [R] tls_client_not_before Return the start date of a client certificate in seconds since the epoch. .UNINDENT .INDENT 7.0 .TP .B attribute [R] tls_client_not_after Return the end date of a client certificate in seconds since the epoch. .UNINDENT .INDENT 7.0 .TP .B attribute [R] tls_cipher Return a TLS cipher negotiated in this connection. .UNINDENT .INDENT 7.0 .TP .B attribute [R] tls_protocol Return a TLS protocol version negotiated in this connection. .UNINDENT .INDENT 7.0 .TP .B attribute [R] tls_session_id Return a session ID for this connection in hex string. .UNINDENT .INDENT 7.0 .TP .B attribute [R] tls_session_reused Return true if, and only if a SSL/TLS session is reused. .UNINDENT .INDENT 7.0 .TP .B attribute [R] alpn Return ALPN identifier negotiated in this connection. .UNINDENT .INDENT 7.0 .TP .B attribute [R] tls_handshake_finished Return true if SSL/TLS handshake has finished. If it returns false in the request phase hook, the request is received in TLSv1.3 early data (0\-RTT) and might be vulnerable to the replay attack. nghttpx will send Early\-Data header field to backend servers to indicate this. .UNINDENT .UNINDENT .INDENT 0.0 .TP .B class Nghttpx::Request Object to represent request from client. The modification to Request object is allowed only in request phase hook. .INDENT 7.0 .TP .B attribute [R] http_version_major Return HTTP major version. .UNINDENT .INDENT 7.0 .TP .B attribute [R] http_version_minor Return HTTP minor version. .UNINDENT .INDENT 7.0 .TP .B attribute [R/W] method HTTP method. On assignment, copy of given value is assigned. We don\(aqt accept arbitrary method name. We will document them later, but well known methods, like GET, PUT and POST, are all supported. .UNINDENT .INDENT 7.0 .TP .B attribute [R/W] authority Authority (i.e., example.org), including optional port component . On assignment, copy of given value is assigned. .UNINDENT .INDENT 7.0 .TP .B attribute [R/W] scheme Scheme (i.e., http, https). On assignment, copy of given value is assigned. .UNINDENT .INDENT 7.0 .TP .B attribute [R/W] path Request path, including query component (i.e., /index.html). On assignment, copy of given value is assigned. The path does not include authority component of URI. This may include query component. nghttpx makes certain normalization for path. It decodes percent\-encoding for unreserved characters (see \fI\%https://tools.ietf.org/html/rfc3986#section\-2.3\fP), and resolves \(dq..\(dq and \(dq.\(dq. But it may leave characters which should be percent\-encoded as is. So be careful when comparing path against desired string. .UNINDENT .INDENT 7.0 .TP .B attribute [R] headers Return Ruby hash containing copy of request header fields. Changing values in returned hash does not change request header fields actually used in request processing. Use \fI\%Nghttpx::Request#add_header\fP or \fI\%Nghttpx::Request#set_header\fP to change request header fields. .UNINDENT .INDENT 7.0 .TP .B add_header(key, value) Add header entry associated with key. The value can be single string or array of string. It does not replace any existing values associated with key. .UNINDENT .INDENT 7.0 .TP .B set_header(key, value) Set header entry associated with key. The value can be single string or array of string. It replaces any existing values associated with key. .UNINDENT .INDENT 7.0 .TP .B clear_headers() Clear all existing request header fields. .UNINDENT .INDENT 7.0 .TP .B push(uri) Initiate to push resource identified by \fIuri\fP\&. Only HTTP/2 protocol supports this feature. For the other protocols, this method is noop. \fIuri\fP can be absolute URI, absolute path or relative path to the current request. For absolute or relative path, scheme and authority are inherited from the current request. Currently, method is always GET. nghttpx will issue request to backend servers to fulfill this request. The request and response phase hooks will be called for pushed resource as well. .UNINDENT .UNINDENT .INDENT 0.0 .TP .B class Nghttpx::Response Object to represent response from backend server. .INDENT 7.0 .TP .B attribute [R] http_version_major Return HTTP major version. .UNINDENT .INDENT 7.0 .TP .B attribute [R] http_version_minor Return HTTP minor version. .UNINDENT .INDENT 7.0 .TP .B attribute [R/W] status HTTP status code. It must be in the range [200, 999], inclusive. The non\-final status code is not supported in mruby scripting at the moment. .UNINDENT .INDENT 7.0 .TP .B attribute [R] headers Return Ruby hash containing copy of response header fields. Changing values in returned hash does not change response header fields actually used in response processing. Use \fI\%Nghttpx::Response#add_header\fP or \fI\%Nghttpx::Response#set_header\fP to change response header fields. .UNINDENT .INDENT 7.0 .TP .B add_header(key, value) Add header entry associated with key. The value can be single string or array of string. It does not replace any existing values associated with key. .UNINDENT .INDENT 7.0 .TP .B set_header(key, value) Set header entry associated with key. The value can be single string or array of string. It replaces any existing values associated with key. .UNINDENT .INDENT 7.0 .TP .B clear_headers() Clear all existing response header fields. .UNINDENT .INDENT 7.0 .TP .B return(body) Return custom response \fIbody\fP to a client. When this method is called in request phase hook, the request is not forwarded to the backend, and response phase hook for this request will not be invoked. When this method is called in response phase hook, response from backend server is canceled and discarded. The status code and response header fields should be set before using this method. To set status code, use \fI\%Nghttpx::Response#status\fP\&. If status code is not set, 200 is used. To set response header fields, \fI\%Nghttpx::Response#add_header\fP and \fI\%Nghttpx::Response#set_header\fP\&. When this method is invoked in response phase hook, the response headers are filled with the ones received from backend server. To send completely custom header fields, first call \fI\%Nghttpx::Response#clear_headers\fP to erase all existing header fields, and then add required header fields. It is an error to call this method twice for a given request. .UNINDENT .INDENT 7.0 .TP .B send_info(status, headers) Send non\-final (informational) response to a client. \fIstatus\fP must be in the range [100, 199], inclusive. \fIheaders\fP is a hash containing response header fields. Its key must be a string, and the associated value must be either string or array of strings. Since this is not a final response, even if this method is invoked, request is still forwarded to a backend unless \fI\%Nghttpx::Response#return\fP is called. This method can be called multiple times. It cannot be called after \fI\%Nghttpx::Response#return\fP is called. .UNINDENT .UNINDENT .SS MRUBY EXAMPLES .sp Modify request path: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C class App def on_req(env) env.req.path = \(dq/apps#{env.req.path}\(dq end end App.new .ft P .fi .UNINDENT .UNINDENT .sp Don\(aqt forget to instantiate and evaluate object at the last line. .sp Restrict permission of viewing a content to a specific client addresses: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C class App def on_req(env) allowed_clients = [\(dq127.0.0.1\(dq, \(dq::1\(dq] if env.req.path.start_with?(\(dq/log/\(dq) && !allowed_clients.include?(env.remote_addr) then env.resp.status = 404 env.resp.return \(dqpermission denied\(dq end end end App.new .ft P .fi .UNINDENT .UNINDENT .SH API ENDPOINTS .sp nghttpx exposes API endpoints to manipulate it via HTTP based API. By default, API endpoint is disabled. To enable it, add a dedicated frontend for API using \fI\%\-\-frontend\fP option with \(dqapi\(dq parameter. All requests which come from this frontend address, will be treated as API request. .sp The response is normally JSON dictionary, and at least includes the following keys: .INDENT 0.0 .TP .B status The status of the request processing. The following values are defined: .INDENT 7.0 .TP .B Success The request was successful. .TP .B Failure The request was failed. No change has been made. .UNINDENT .TP .B code HTTP status code .UNINDENT .sp Additionally, depending on the API endpoint, \fBdata\fP key may be present, and its value contains the API endpoint specific data. .sp We wrote \(dqnormally\(dq, since nghttpx may return ordinal HTML response in some cases where the error has occurred before reaching API endpoint (e.g., header field is too large). .sp The following section describes available API endpoints. .SS POST /api/v1beta1/backendconfig .sp This API replaces the current backend server settings with the requested ones. The request method should be POST, but PUT is also acceptable. The request body must be nghttpx configuration file format. For configuration file format, see \fI\%FILES\fP section. The line separator inside the request body must be single LF (0x0A). Currently, only \fI\%backend\fP option is parsed, the others are simply ignored. The semantics of this API is replace the current backend with the backend options in request body. Describe the desired set of backend severs, and nghttpx makes it happen. If there is no \fI\%backend\fP option is found in request body, the current set of backend is replaced with the \fI\%backend\fP option\(aqs default value, which is \fB127.0.0.1,80\fP\&. .sp The replacement is done instantly without breaking existing connections or requests. It also avoids any process creation as is the case with hot swapping with signals. .sp The one limitation is that only numeric IP address is allowed in \fI\%backend\fP in request body unless \(dqdns\(dq parameter is used while non numeric hostname is allowed in command\-line or configuration file is read using \fI\%\-\-conf\fP\&. .SS GET /api/v1beta1/configrevision .sp This API returns configuration revision of the current nghttpx. The configuration revision is opaque string, and it changes after each reloading by SIGHUP. With this API, an external application knows that whether nghttpx has finished reloading its configuration by comparing the configuration revisions between before and after reloading. It is recommended to disable persistent (keep\-alive) connection for this purpose in order to avoid to send a request using the reused connection which may bound to an old process. .sp This API returns response including \fBdata\fP key. Its value is JSON object, and it contains at least the following key: .INDENT 0.0 .TP .B configRevision The configuration revision of the current nghttpx .UNINDENT .SH SEE ALSO .sp \fBnghttp(1)\fP, \fBnghttpd(1)\fP, \fBh2load(1)\fP .SH AUTHOR Tatsuhiro Tsujikawa .SH COPYRIGHT 2012, 2015, 2016, Tatsuhiro Tsujikawa .\" Generated by docutils manpage writer. . PKn;iZOMG==man/man1/h2load.1nu[.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "H2LOAD" "1" "Apr 04, 2024" "1.61.0" "nghttp2" .SH NAME h2load \- HTTP/2 benchmarking tool .SH SYNOPSIS .sp \fBh2load\fP [OPTIONS]... [URI]... .SH DESCRIPTION .sp benchmarking tool for HTTP/2 server .INDENT 0.0 .TP .B Specify URI to access. Multiple URIs can be specified. URIs are used in this order for each client. All URIs are used, then first URI is used and then 2nd URI, and so on. The scheme, host and port in the subsequent URIs, if present, are ignored. Those in the first URI are used solely. Definition of a base URI overrides all scheme, host or port values. .UNINDENT .SH OPTIONS .INDENT 0.0 .TP .B \-n, \-\-requests= Number of requests across all clients. If it is used with \fI\%\-\-timing\-script\-file\fP option, this option specifies the number of requests each client performs rather than the number of requests across all clients. This option is ignored if timing\-based benchmarking is enabled (see \fI\%\-\-duration\fP option). .sp Default: \fB1\fP .UNINDENT .INDENT 0.0 .TP .B \-c, \-\-clients= Number of concurrent clients. With \fI\%\-r\fP option, this specifies the maximum number of connections to be made. .sp Default: \fB1\fP .UNINDENT .INDENT 0.0 .TP .B \-t, \-\-threads= Number of native threads. .sp Default: \fB1\fP .UNINDENT .INDENT 0.0 .TP .B \-i, \-\-input\-file= Path of a file with multiple URIs are separated by EOLs. This option will disable URIs getting from command\-line. If \(aq\-\(aq is given as , URIs will be read from stdin. URIs are used in this order for each client. All URIs are used, then first URI is used and then 2nd URI, and so on. The scheme, host and port in the subsequent URIs, if present, are ignored. Those in the first URI are used solely. Definition of a base URI overrides all scheme, host or port values. .UNINDENT .INDENT 0.0 .TP .B \-m, \-\-max\-concurrent\-streams= Max concurrent streams to issue per session. When http/1.1 is used, this specifies the number of HTTP pipelining requests in\-flight. .sp Default: \fB1\fP .UNINDENT .INDENT 0.0 .TP .B \-f, \-\-max\-frame\-size= Maximum frame size that the local endpoint is willing to receive. .sp Default: \fB16K\fP .UNINDENT .INDENT 0.0 .TP .B \-w, \-\-window\-bits= Sets the stream level initial window size to (2**)\-1. For QUIC, is capped to 26 (roughly 64MiB). .sp Default: \fB30\fP .UNINDENT .INDENT 0.0 .TP .B \-W, \-\-connection\-window\-bits= Sets the connection level initial window size to (2**)\-1. .sp Default: \fB30\fP .UNINDENT .INDENT 0.0 .TP .B \-H, \-\-header=
Add/Override a header to the requests. .UNINDENT .INDENT 0.0 .TP .B \-\-ciphers= Set allowed cipher list for TLSv1.2 or earlier. The format of the string is described in OpenSSL ciphers(1). .sp Default: \fBECDHE\-ECDSA\-AES128\-GCM\-SHA256:ECDHE\-RSA\-AES128\-GCM\-SHA256:ECDHE\-ECDSA\-AES256\-GCM\-SHA384:ECDHE\-RSA\-AES256\-GCM\-SHA384:ECDHE\-ECDSA\-CHACHA20\-POLY1305:ECDHE\-RSA\-CHACHA20\-POLY1305:DHE\-RSA\-AES128\-GCM\-SHA256:DHE\-RSA\-AES256\-GCM\-SHA384\fP .UNINDENT .INDENT 0.0 .TP .B \-\-tls13\-ciphers= Set allowed cipher list for TLSv1.3. The format of the string is described in OpenSSL ciphers(1). .sp Default: \fBTLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_CCM_SHA256\fP .UNINDENT .INDENT 0.0 .TP .B \-p, \-\-no\-tls\-proto= Specify ALPN identifier of the protocol to be used when accessing http URI without SSL/TLS. Available protocols: h2c and http/1.1 .sp Default: \fBh2c\fP .UNINDENT .INDENT 0.0 .TP .B \-d, \-\-data= Post FILE to server. The request method is changed to POST. For http/1.1 connection, if \fI\%\-d\fP is used, the maximum number of in\-flight pipelined requests is set to 1. .UNINDENT .INDENT 0.0 .TP .B \-r, \-\-rate= Specifies the fixed rate at which connections are created. The rate must be a positive integer, representing the number of connections to be made per rate period. The maximum number of connections to be made is given in \fI\%\-c\fP option. This rate will be distributed among threads as evenly as possible. For example, with \fI\%\-t\fP2 and \fI\%\-r\fP4, each thread gets 2 connections per period. When the rate is 0, the program will run as it normally does, creating connections at whatever variable rate it wants. The default value for this option is 0. \fI\%\-r\fP and \fI\%\-D\fP are mutually exclusive. .UNINDENT .INDENT 0.0 .TP .B \-\-rate\-period= Specifies the time period between creating connections. The period must be a positive number, representing the length of the period in time. This option is ignored if the rate option is not used. The default value for this option is 1s. .UNINDENT .INDENT 0.0 .TP .B \-D, \-\-duration= Specifies the main duration for the measurements in case of timing\-based benchmarking. \fI\%\-D\fP and \fI\%\-r\fP are mutually exclusive. .UNINDENT .INDENT 0.0 .TP .B \-\-warm\-up\-time= Specifies the time period before starting the actual measurements, in case of timing\-based benchmarking. Needs to provided along with \fI\%\-D\fP option. .UNINDENT .INDENT 0.0 .TP .B \-T, \-\-connection\-active\-timeout= Specifies the maximum time that h2load is willing to keep a connection open, regardless of the activity on said connection. must be a positive integer, specifying the amount of time to wait. When no timeout value is set (either active or inactive), h2load will keep a connection open indefinitely, waiting for a response. .UNINDENT .INDENT 0.0 .TP .B \-N, \-\-connection\-inactivity\-timeout= Specifies the amount of time that h2load is willing to wait to see activity on a given connection. must be a positive integer, specifying the amount of time to wait. When no timeout value is set (either active or inactive), h2load will keep a connection open indefinitely, waiting for a response. .UNINDENT .INDENT 0.0 .TP .B \-\-timing\-script\-file= Path of a file containing one or more lines separated by EOLs. Each script line is composed of two tab\-separated fields. The first field represents the time offset from the start of execution, expressed as a positive value of milliseconds with microsecond resolution. The second field represents the URI. This option will disable URIs getting from command\-line. If \(aq\-\(aq is given as , script lines will be read from stdin. Script lines are used in order for each client. If \fI\%\-n\fP is given, it must be less than or equal to the number of script lines, larger values are clamped to the number of script lines. If \fI\%\-n\fP is not given, the number of requests will default to the number of script lines. The scheme, host and port defined in the first URI are used solely. Values contained in other URIs, if present, are ignored. Definition of a base URI overrides all scheme, host or port values. \fI\%\-\-timing\-script\-file\fP and \fI\%\-\-rps\fP are mutually exclusive. .UNINDENT .INDENT 0.0 .TP .B \-B, \-\-base\-uri=(|unix:) Specify URI from which the scheme, host and port will be used for all requests. The base URI overrides all values defined either at the command line or inside input files. If argument starts with \(dqunix:\(dq, then the rest of the argument will be treated as UNIX domain socket path. The connection is made through that path instead of TCP. In this case, scheme is inferred from the first URI appeared in the command line or inside input files as usual. .UNINDENT .INDENT 0.0 .TP .B \-\-alpn\-list= Comma delimited list of ALPN protocol identifier sorted in the order of preference. That means most desirable protocol comes first. The parameter must be delimited by a single comma only and any white spaces are treated as a part of protocol string. .sp Default: \fBh2,h2\-16,h2\-14,http/1.1\fP .UNINDENT .INDENT 0.0 .TP .B \-\-h1 Short hand for \fI\%\-\-alpn\-list\fP=http/1.1 \fI\%\-\-no\-tls\-proto\fP=http/1.1, which effectively force http/1.1 for both http and https URI. .UNINDENT .INDENT 0.0 .TP .B \-\-header\-table\-size= Specify decoder header table size. .sp Default: \fB4K\fP .UNINDENT .INDENT 0.0 .TP .B \-\-encoder\-header\-table\-size= Specify encoder header table size. The decoder (server) specifies the maximum dynamic table size it accepts. Then the negotiated dynamic table size is the minimum of this option value and the value which server specified. .sp Default: \fB4K\fP .UNINDENT .INDENT 0.0 .TP .B \-\-log\-file= Write per\-request information to a file as tab\-separated columns: start time as microseconds since epoch; HTTP status code; microseconds until end of response. More columns may be added later. Rows are ordered by end\-of\- response time when using one worker thread, but may appear slightly out of order with multiple threads due to buffering. Status code is \-1 for failed streams. .UNINDENT .INDENT 0.0 .TP .B \-\-qlog\-file\-base= Enable qlog output and specify base file name for qlogs. Qlog is emitted for each connection. For a given base name \(dqbase\(dq, each output file name becomes \(dqbase.M.N.sqlog\(dq where M is worker ID and N is client ID (e.g. \(dqbase.0.3.sqlog\(dq). Only effective in QUIC runs. .UNINDENT .INDENT 0.0 .TP .B \-\-connect\-to=[:] Host and port to connect instead of using the authority in . .UNINDENT .INDENT 0.0 .TP .B \-\-rps= Specify request per second for each client. \fI\%\-\-rps\fP and \fI\%\-\-timing\-script\-file\fP are mutually exclusive. .UNINDENT .INDENT 0.0 .TP .B \-\-groups= Specify the supported groups. .sp Default: \fBX25519:P\-256:P\-384:P\-521\fP .UNINDENT .INDENT 0.0 .TP .B \-\-no\-udp\-gso Disable UDP GSO. .UNINDENT .INDENT 0.0 .TP .B \-\-max\-udp\-payload\-size= Specify the maximum outgoing UDP datagram payload size. .UNINDENT .INDENT 0.0 .TP .B \-\-ktls Enable ktls. .UNINDENT .INDENT 0.0 .TP .B \-\-sni= Send in TLS SNI, overriding the host name specified in URI. .UNINDENT .INDENT 0.0 .TP .B \-v, \-\-verbose Output debug information. .UNINDENT .INDENT 0.0 .TP .B \-\-version Display version information and exit. .UNINDENT .INDENT 0.0 .TP .B \-h, \-\-help Display this help and exit. .UNINDENT .sp The argument is an integer and an optional unit (e.g., 10K is 10 * 1024). Units are K, M and G (powers of 1024). .sp The argument is an integer and an optional unit (e.g., 1s is 1 second and 500ms is 500 milliseconds). Units are h, m, s or ms (hours, minutes, seconds and milliseconds, respectively). If a unit is omitted, a second is used as unit. .SH OUTPUT .INDENT 0.0 .TP .B requests .INDENT 7.0 .TP .B total The number of requests h2load was instructed to make. .TP .B started The number of requests h2load has started. .TP .B done The number of requests completed. .TP .B succeeded The number of requests completed successfully. Only HTTP status code 2xx or3xx are considered as success. .TP .B failed The number of requests failed, including HTTP level failures (non\-successful HTTP status code). .TP .B errored The number of requests failed, except for HTTP level failures. This is the subset of the number reported in \fBfailed\fP and most likely the network level failures or stream was reset by RST_STREAM. .TP .B timeout The number of requests whose connection timed out before they were completed. This is the subset of the number reported in \fBerrored\fP\&. .UNINDENT .TP .B status codes The number of status code h2load received. .TP .B traffic .INDENT 7.0 .TP .B total The number of bytes received from the server \(dqon the wire\(dq. If requests were made via TLS, this value is the number of decrypted bytes. .TP .B headers The number of response header bytes from the server without decompression. The \fBspace savings\fP shows efficiency of header compression. Let \fBdecompressed(headers)\fP to the number of bytes used for header fields after decompression. The \fBspace savings\fP is calculated by (1 \- \fBheaders\fP / \fBdecompressed(headers)\fP) * 100. For HTTP/1.1, this is usually 0.00%, since it does not have header compression. For HTTP/2, it shows some insightful numbers. .TP .B data The number of response body bytes received from the server. .UNINDENT .TP .B time for request .INDENT 7.0 .TP .B min The minimum time taken for request and response. .TP .B max The maximum time taken for request and response. .TP .B mean The mean time taken for request and response. .TP .B sd The standard deviation of the time taken for request and response. .TP .B +/\- sd The fraction of the number of requests within standard deviation range (mean +/\- sd) against total number of successful requests. .UNINDENT .TP .B time for connect .INDENT 7.0 .TP .B min The minimum time taken to connect to a server including TLS handshake. .TP .B max The maximum time taken to connect to a server including TLS handshake. .TP .B mean The mean time taken to connect to a server including TLS handshake. .TP .B sd The standard deviation of the time taken to connect to a server. .TP .B +/\- sd The fraction of the number of connections within standard deviation range (mean +/\- sd) against total number of successful connections. .UNINDENT .TP .B time for 1st byte (of (decrypted in case of TLS) application data) .INDENT 7.0 .TP .B min The minimum time taken to get 1st byte from a server. .TP .B max The maximum time taken to get 1st byte from a server. .TP .B mean The mean time taken to get 1st byte from a server. .TP .B sd The standard deviation of the time taken to get 1st byte from a server. .TP .B +/\- sd The fraction of the number of connections within standard deviation range (mean +/\- sd) against total number of successful connections. .UNINDENT .TP .B req/s .INDENT 7.0 .TP .B min The minimum request per second among all clients. .TP .B max The maximum request per second among all clients. .TP .B mean The mean request per second among all clients. .TP .B sd The standard deviation of request per second among all clients. server. .TP .B +/\- sd The fraction of the number of connections within standard deviation range (mean +/\- sd) against total number of successful connections. .UNINDENT .UNINDENT .SH FLOW CONTROL .sp h2load sets large flow control window by default, and effectively disables flow control to avoid under utilization of server performance. To set smaller flow control window, use \fI\%\-w\fP and \fI\%\-W\fP options. For example, use \fB\-w16 \-W16\fP to set default window size described in HTTP/2 protocol specification. .SH SEE ALSO .sp \fBnghttp(1)\fP, \fBnghttpd(1)\fP, \fBnghttpx(1)\fP .SH AUTHOR Tatsuhiro Tsujikawa .SH COPYRIGHT 2012, 2015, 2016, Tatsuhiro Tsujikawa .\" Generated by docutils manpage writer. . PKn;iZL[0#0#man/man1/nghttp.1nu[.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "NGHTTP" "1" "Apr 04, 2024" "1.61.0" "nghttp2" .SH NAME nghttp \- HTTP/2 client .SH SYNOPSIS .sp \fBnghttp\fP [OPTIONS]... ... .SH DESCRIPTION .sp HTTP/2 client .INDENT 0.0 .TP .B Specify URI to access. .UNINDENT .SH OPTIONS .INDENT 0.0 .TP .B \-v, \-\-verbose Print debug information such as reception and transmission of frames and name/value pairs. Specifying this option multiple times increases verbosity. .UNINDENT .INDENT 0.0 .TP .B \-n, \-\-null\-out Discard downloaded data. .UNINDENT .INDENT 0.0 .TP .B \-O, \-\-remote\-name Save download data in the current directory. The filename is derived from URI. If URI ends with \(aq\fI/\fP\(aq, \(aqindex.html\(aq is used as a filename. Not implemented yet. .UNINDENT .INDENT 0.0 .TP .B \-t, \-\-timeout= Timeout each request after . Set 0 to disable timeout. .UNINDENT .INDENT 0.0 .TP .B \-w, \-\-window\-bits= Sets the stream level initial window size to 2**\-1. .UNINDENT .INDENT 0.0 .TP .B \-W, \-\-connection\-window\-bits= Sets the connection level initial window size to 2**\-1. .UNINDENT .INDENT 0.0 .TP .B \-a, \-\-get\-assets Download assets such as stylesheets, images and script files linked from the downloaded resource. Only links whose origins are the same with the linking resource will be downloaded. nghttp prioritizes resources using HTTP/2 dependency based priority. The priority order, from highest to lowest, is html itself, css, javascript and images. .UNINDENT .INDENT 0.0 .TP .B \-s, \-\-stat Print statistics. .UNINDENT .INDENT 0.0 .TP .B \-H, \-\-header=
Add a header to the requests. Example: \fI\%\-H\fP\(aq:method: PUT\(aq .UNINDENT .INDENT 0.0 .TP .B \-\-trailer=
Add a trailer header to the requests.
must not include pseudo header field (header field name starting with \(aq:\(aq). To send trailer, one must use \fI\%\-d\fP option to send request body. Example: \fI\%\-\-trailer\fP \(aqfoo: bar\(aq. .UNINDENT .INDENT 0.0 .TP .B \-\-cert= Use the specified client certificate file. The file must be in PEM format. .UNINDENT .INDENT 0.0 .TP .B \-\-key= Use the client private key file. The file must be in PEM format. .UNINDENT .INDENT 0.0 .TP .B \-d, \-\-data= Post FILE to server. If \(aq\-\(aq is given, data will be read from stdin. .UNINDENT .INDENT 0.0 .TP .B \-m, \-\-multiply= Request each URI times. By default, same URI is not requested twice. This option disables it too. .UNINDENT .INDENT 0.0 .TP .B \-u, \-\-upgrade Perform HTTP Upgrade for HTTP/2. This option is ignored if the request URI has https scheme. If \fI\%\-d\fP is used, the HTTP upgrade request is performed with OPTIONS method. .UNINDENT .INDENT 0.0 .TP .B \-p, \-\-weight= Sets weight of given URI. This option can be used multiple times, and N\-th \fI\%\-p\fP option sets weight of N\-th URI in the command line. If the number of \fI\%\-p\fP option is less than the number of URI, the last \fI\%\-p\fP option value is repeated. If there is no \fI\%\-p\fP option, default weight, 16, is assumed. The valid value range is [1, 256], inclusive. .UNINDENT .INDENT 0.0 .TP .B \-M, \-\-peer\-max\-concurrent\-streams= Use as SETTINGS_MAX_CONCURRENT_STREAMS value of remote endpoint as if it is received in SETTINGS frame. .sp Default: \fB100\fP .UNINDENT .INDENT 0.0 .TP .B \-c, \-\-header\-table\-size= Specify decoder header table size. If this option is used multiple times, and the minimum value among the given values except for last one is strictly less than the last value, that minimum value is set in SETTINGS frame payload before the last value, to simulate multiple header table size change. .UNINDENT .INDENT 0.0 .TP .B \-\-encoder\-header\-table\-size= Specify encoder header table size. The decoder (server) specifies the maximum dynamic table size it accepts. Then the negotiated dynamic table size is the minimum of this option value and the value which server specified. .UNINDENT .INDENT 0.0 .TP .B \-b, \-\-padding= Add at most bytes to a frame payload as padding. Specify 0 to disable padding. .UNINDENT .INDENT 0.0 .TP .B \-r, \-\-har= Output HTTP transactions in HAR format. If \(aq\-\(aq is given, data is written to stdout. .UNINDENT .INDENT 0.0 .TP .B \-\-color Force colored log output. .UNINDENT .INDENT 0.0 .TP .B \-\-continuation Send large header to test CONTINUATION. .UNINDENT .INDENT 0.0 .TP .B \-\-no\-content\-length Don\(aqt send content\-length header field. .UNINDENT .INDENT 0.0 .TP .B \-\-no\-dep Don\(aqt send dependency based priority hint to server. .UNINDENT .INDENT 0.0 .TP .B \-\-hexdump Display the incoming traffic in hexadecimal (Canonical hex+ASCII display). If SSL/TLS is used, decrypted data are used. .UNINDENT .INDENT 0.0 .TP .B \-\-no\-push Disable server push. .UNINDENT .INDENT 0.0 .TP .B \-\-max\-concurrent\-streams= The number of concurrent pushed streams this client accepts. .UNINDENT .INDENT 0.0 .TP .B \-\-expect\-continue Perform an Expect/Continue handshake: wait to send DATA (up to a short timeout) until the server sends a 100 Continue interim response. This option is ignored unless combined with the \fI\%\-d\fP option. .UNINDENT .INDENT 0.0 .TP .B \-y, \-\-no\-verify\-peer Suppress warning on server certificate verification failure. .UNINDENT .INDENT 0.0 .TP .B \-\-ktls Enable ktls. .UNINDENT .INDENT 0.0 .TP .B \-\-no\-rfc7540\-pri Disable RFC7540 priorities. .UNINDENT .INDENT 0.0 .TP .B \-\-version Display version information and exit. .UNINDENT .INDENT 0.0 .TP .B \-h, \-\-help Display this help and exit. .UNINDENT .sp The argument is an integer and an optional unit (e.g., 10K is 10 * 1024). Units are K, M and G (powers of 1024). .sp The argument is an integer and an optional unit (e.g., 1s is 1 second and 500ms is 500 milliseconds). Units are h, m, s or ms (hours, minutes, seconds and milliseconds, respectively). If a unit is omitted, a second is used as unit. .SH DEPENDENCY BASED PRIORITY .sp nghttp sends priority hints to server by default unless \fI\%\-\-no\-dep\fP is used. nghttp mimics the way Firefox employs to manages dependency using idle streams. We follows the behaviour of Firefox Nightly as of April, 2015, and nghttp\(aqs behaviour is very static and could be different from Firefox in detail. But reproducing the same behaviour of Firefox is not our goal. The goal is provide the easy way to test out the dependency priority in server implementation. .sp When connection is established, nghttp sends 5 PRIORITY frames to idle streams 3, 5, 7, 9 and 11 to create \(dqanchor\(dq nodes in dependency tree: .INDENT 0.0 .INDENT 3.5 .sp .nf .ft C +\-\-\-\-\-+ |id=0 | +\-\-\-\-\-+ ^ ^ ^ w=201 / | \e w=1 / | \e / w=101| \e +\-\-\-\-\-+ +\-\-\-\-\-+ +\-\-\-\-\-+ |id=3 | |id=5 | |id=7 | +\-\-\-\-\-+ +\-\-\-\-\-+ +\-\-\-\-\-+ ^ ^ w=1 | w=1 | | | +\-\-\-\-\-+ +\-\-\-\-\-+ |id=11| |id=9 | +\-\-\-\-\-+ +\-\-\-\-\-+ .ft P .fi .UNINDENT .UNINDENT .sp In the above figure, \fBid\fP means stream ID, and \fBw\fP means weight. The stream 0 is non\-existence stream, and forms the root of the tree. The stream 7 and 9 are not used for now. .sp The URIs given in the command\-line depend on stream 11 with the weight given in \fI\%\-p\fP option, which defaults to 16. .sp If \fI\%\-a\fP option is used, nghttp parses the resource pointed by URI given in command\-line as html, and extracts resource links from it. When requesting those resources, nghttp uses dependency according to its resource type. .sp For CSS, and Javascript files inside \(dqhead\(dq element, they depend on stream 3 with the weight 2. The Javascript files outside \(dqhead\(dq element depend on stream 5 with the weight 2. The mages depend on stream 11 with the weight 12. The other resources (e.g., icon) depend on stream 11 with the weight 2. .SH SEE ALSO .sp \fBnghttpd(1)\fP, \fBnghttpx(1)\fP, \fBh2load(1)\fP .SH AUTHOR Tatsuhiro Tsujikawa .SH COPYRIGHT 2012, 2015, 2016, Tatsuhiro Tsujikawa .\" Generated by docutils manpage writer. . PKn;iZmman/man1/nghttpd.1nu[.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "NGHTTPD" "1" "Apr 04, 2024" "1.61.0" "nghttp2" .SH NAME nghttpd \- HTTP/2 server .SH SYNOPSIS .sp \fBnghttpd\fP [OPTION]... [ ] .SH DESCRIPTION .sp HTTP/2 server .INDENT 0.0 .TP .B Specify listening port number. .UNINDENT .INDENT 0.0 .TP .B Set path to server\(aqs private key. Required unless \fI\%\-\-no\-tls\fP is specified. .UNINDENT .INDENT 0.0 .TP .B Set path to server\(aqs certificate. Required unless \fI\%\-\-no\-tls\fP is specified. .UNINDENT .SH OPTIONS .INDENT 0.0 .TP .B \-a, \-\-address= The address to bind to. If not specified the default IP address determined by getaddrinfo is used. .UNINDENT .INDENT 0.0 .TP .B \-D, \-\-daemon Run in a background. If \fI\%\-D\fP is used, the current working directory is changed to \(aq\fI/\fP\(aq. Therefore if this option is used, \fI\%\-d\fP option must be specified. .UNINDENT .INDENT 0.0 .TP .B \-V, \-\-verify\-client The server sends a client certificate request. If the client did not return a certificate, the handshake is terminated. Currently, this option just requests a client certificate and does not verify it. .UNINDENT .INDENT 0.0 .TP .B \-d, \-\-htdocs= Specify document root. If this option is not specified, the document root is the current working directory. .UNINDENT .INDENT 0.0 .TP .B \-v, \-\-verbose Print debug information such as reception/ transmission of frames and name/value pairs. .UNINDENT .INDENT 0.0 .TP .B \-\-no\-tls Disable SSL/TLS. .UNINDENT .INDENT 0.0 .TP .B \-c, \-\-header\-table\-size= Specify decoder header table size. .UNINDENT .INDENT 0.0 .TP .B \-\-encoder\-header\-table\-size= Specify encoder header table size. The decoder (client) specifies the maximum dynamic table size it accepts. Then the negotiated dynamic table size is the minimum of this option value and the value which client specified. .UNINDENT .INDENT 0.0 .TP .B \-\-color Force colored log output. .UNINDENT .INDENT 0.0 .TP .B \-p, \-\-push== Push resources s when is requested. This option can be used repeatedly to specify multiple push configurations. and s are relative to document root. See \fI\%\-\-htdocs\fP option. Example: \fI\%\-p\fP/=/foo.png \fI\%\-p\fP/doc=/bar.css .UNINDENT .INDENT 0.0 .TP .B \-b, \-\-padding= Add at most bytes to a frame payload as padding. Specify 0 to disable padding. .UNINDENT .INDENT 0.0 .TP .B \-m, \-\-max\-concurrent\-streams= Set the maximum number of the concurrent streams in one HTTP/2 session. .sp Default: \fB100\fP .UNINDENT .INDENT 0.0 .TP .B \-n, \-\-workers= Set the number of worker threads. .sp Default: \fB1\fP .UNINDENT .INDENT 0.0 .TP .B \-e, \-\-error\-gzip Make error response gzipped. .UNINDENT .INDENT 0.0 .TP .B \-w, \-\-window\-bits= Sets the stream level initial window size to 2**\-1. .UNINDENT .INDENT 0.0 .TP .B \-W, \-\-connection\-window\-bits= Sets the connection level initial window size to 2**\-1. .UNINDENT .INDENT 0.0 .TP .B \-\-dh\-param\-file= Path to file that contains DH parameters in PEM format. Without this option, DHE cipher suites are not available. .UNINDENT .INDENT 0.0 .TP .B \-\-early\-response Start sending response when request HEADERS is received, rather than complete request is received. .UNINDENT .INDENT 0.0 .TP .B \-\-trailer=
Add a trailer header to a response.
must not include pseudo header field (header field name starting with \(aq:\(aq). The trailer is sent only if a response has body part. Example: \fI\%\-\-trailer\fP \(aqfoo: bar\(aq. .UNINDENT .INDENT 0.0 .TP .B \-\-hexdump Display the incoming traffic in hexadecimal (Canonical hex+ASCII display). If SSL/TLS is used, decrypted data are used. .UNINDENT .INDENT 0.0 .TP .B \-\-echo\-upload Send back uploaded content if method is POST or PUT. .UNINDENT .INDENT 0.0 .TP .B \-\-mime\-types\-file= Path to file that contains MIME media types and the extensions that represent them. .sp Default: \fB/etc/mime.types\fP .UNINDENT .INDENT 0.0 .TP .B \-\-no\-content\-length Don\(aqt send content\-length header field. .UNINDENT .INDENT 0.0 .TP .B \-\-ktls Enable ktls. .UNINDENT .INDENT 0.0 .TP .B \-\-no\-rfc7540\-pri Disable RFC7540 priorities. .UNINDENT .INDENT 0.0 .TP .B \-\-version Display version information and exit. .UNINDENT .INDENT 0.0 .TP .B \-h, \-\-help Display this help and exit. .UNINDENT .sp The argument is an integer and an optional unit (e.g., 10K is 10 * 1024). Units are K, M and G (powers of 1024). .SH SEE ALSO .sp \fBnghttp(1)\fP, \fBnghttpx(1)\fP, \fBh2load(1)\fP .SH AUTHOR Tatsuhiro Tsujikawa .SH COPYRIGHT 2012, 2015, 2016, Tatsuhiro Tsujikawa .\" Generated by docutils manpage writer. . PKn;iZgdoc/nghttp2/README.rstnu[nghttp2 - HTTP/2 C Library ========================== This is an implementation of the Hypertext Transfer Protocol version 2 in C. The framing layer of HTTP/2 is implemented as a reusable C library. On top of that, we have implemented an HTTP/2 client, server and proxy. We have also developed load test and benchmarking tools for HTTP/2. An HPACK encoder and decoder are available as a public API. Development Status ------------------ nghttp2 was originally developed based on `RFC 7540 `_ HTTP/2 and `RFC 7541 `_ HPACK - Header Compression for HTTP/2. Now we are updating our code to implement `RFC 9113 `_. The nghttp2 code base was forked from the spdylay (https://github.com/tatsuhiro-t/spdylay) project. Public Test Server ------------------ The following endpoints are available to try out our nghttp2 implementation. * https://nghttp2.org/ (TLS + ALPN and HTTP/3) This endpoint supports ``h2``, ``h2-16``, ``h2-14``, and ``http/1.1`` via ALPN and requires TLSv1.2 for HTTP/2 connection. It also supports HTTP/3. * http://nghttp2.org/ (HTTP Upgrade and HTTP/2 Direct) ``h2c`` and ``http/1.1``. Requirements ------------ The following package is required to build the libnghttp2 library: * pkg-config >= 0.20 To build the documentation, you need to install: * sphinx (http://sphinx-doc.org/) If you need libnghttp2 (C library) only, then the above packages are all you need. Use ``--enable-lib-only`` to ensure that only libnghttp2 is built. This avoids potential build error related to building bundled applications. To build and run the application programs (``nghttp``, ``nghttpd``, ``nghttpx`` and ``h2load``) in the ``src`` directory, the following packages are required: * OpenSSL >= 1.1.1; or LibreSSL >= 3.8.1; or aws-lc >= 1.19.0; or BoringSSL * libev >= 4.11 * zlib >= 1.2.3 * libc-ares >= 1.7.5 To enable ``-a`` option (getting linked assets from the downloaded resource) in ``nghttp``, the following package is required: * libxml2 >= 2.6.26 To enable systemd support in nghttpx, the following package is required: * libsystemd-dev >= 209 The HPACK tools require the following package: * jansson >= 2.5 To build sources under the examples directory, libevent is required: * libevent-openssl >= 2.0.8 To mitigate heap fragmentation in long running server programs (``nghttpd`` and ``nghttpx``), jemalloc is recommended: * jemalloc .. note:: Alpine Linux currently does not support malloc replacement due to musl limitations. See details in issue `#762 `_. For BoringSSL or aws-lc build, to enable :rfc:`8879` TLS Certificate Compression in applications, the following library is required: * libbrotli-dev >= 1.0.9 To enable mruby support for nghttpx, `mruby `_ is required. We need to build mruby with C++ ABI explicitly turned on, and probably need other mrgems, mruby is managed by git submodule under third-party/mruby directory. Currently, mruby support for nghttpx is disabled by default. To enable mruby support, use ``--with-mruby`` configure option. Note that at the time of this writing, libmruby-dev and mruby packages in Debian/Ubuntu are not usable for nghttp2, since they do not enable C++ ABI. To build mruby, the following packages are required: * ruby * bison nghttpx supports `neverbleed `_, privilege separation engine for OpenSSL. In short, it minimizes the risk of private key leakage when serious bug like Heartbleed is exploited. The neverbleed is disabled by default. To enable it, use ``--with-neverbleed`` configure option. To enable the experimental HTTP/3 support for h2load and nghttpx, the following libraries are required: * `OpenSSL with QUIC support `_; or LibreSSL (does not support 0RTT); or aws-lc; or `BoringSSL `_ (commit fae0964b3d44e94ca2a2d21f86e61dabe683d130) * `ngtcp2 `_ >= 1.4.0 * `nghttp3 `_ >= 1.1.0 Use ``--enable-http3`` configure option to enable HTTP/3 feature for h2load and nghttpx. In order to build optional eBPF program to direct an incoming QUIC UDP datagram to a correct socket for nghttpx, the following libraries are required: * libbpf-dev >= 0.7.0 Use ``--with-libbpf`` configure option to build eBPF program. libelf-dev is needed to build libbpf. For Ubuntu 20.04, you can build libbpf from `the source code `_. nghttpx requires eBPF program for reloading its configuration and hot swapping its executable. Compiling libnghttp2 C source code requires a C99 compiler. gcc 4.8 is known to be adequate. In order to compile the C++ source code, gcc >= 6.0 or clang >= 6.0 is required. C++ source code requires C++14 language features. .. note:: To enable mruby support in nghttpx, and use ``--with-mruby`` configure option. .. note:: Mac OS X users may need the ``--disable-threads`` configure option to disable multi-threading in nghttpd, nghttpx and h2load to prevent them from crashing. A patch is welcome to make multi threading work on Mac OS X platform. .. note:: To compile the associated applications (nghttp, nghttpd, nghttpx and h2load), you must use the ``--enable-app`` configure option and ensure that the specified requirements above are met. Normally, configure script checks required dependencies to build these applications, and enable ``--enable-app`` automatically, so you don't have to use it explicitly. But if you found that applications were not built, then using ``--enable-app`` may find that cause, such as the missing dependency. .. note:: In order to detect third party libraries, pkg-config is used (however we don't use pkg-config for some libraries (e.g., libev)). By default, pkg-config searches ``*.pc`` file in the standard locations (e.g., /usr/lib/pkgconfig). If it is necessary to use ``*.pc`` file in the custom location, specify paths to ``PKG_CONFIG_PATH`` environment variable, and pass it to configure script, like so: .. code-block:: text $ ./configure PKG_CONFIG_PATH=/path/to/pkgconfig For pkg-config managed libraries, ``*_CFLAG`` and ``*_LIBS`` environment variables are defined (e.g., ``OPENSSL_CFLAGS``, ``OPENSSL_LIBS``). Specifying non-empty string to these variables completely overrides pkg-config. In other words, if they are specified, pkg-config is not used for detection, and user is responsible to specify the correct values to these variables. For complete list of these variables, run ``./configure -h``. If you are using Ubuntu 22.04 LTS, run the following to install the required packages: .. code-block:: text sudo apt-get install g++ clang make binutils autoconf automake \ autotools-dev libtool pkg-config \ zlib1g-dev libssl-dev libxml2-dev libev-dev \ libevent-dev libjansson-dev \ libc-ares-dev libjemalloc-dev libsystemd-dev \ ruby-dev bison libelf-dev Building nghttp2 from release tar archive ----------------------------------------- The nghttp2 project regularly releases tar archives which includes nghttp2 source code, and generated build files. They can be downloaded from `Releases `_ page. Building nghttp2 from git requires autotools development packages. Building from tar archives does not require them, and thus it is much easier. The usual build step is as follows: .. code-block:: text $ tar xf nghttp2-X.Y.Z.tar.bz2 $ cd nghttp2-X.Y.Z $ ./configure $ make Building from git ----------------- Building from git is easy, but please be sure that at least autoconf 2.68 is used: .. code-block:: text $ git submodule update --init $ autoreconf -i $ automake $ autoconf $ ./configure $ make Notes for building on Windows (MSVC) ------------------------------------ The easiest way to build native Windows nghttp2 dll is use `cmake `_. The free version of `Visual C++ Build Tools `_ works fine. 1. Install cmake for windows 2. Open "Visual C++ ... Native Build Tool Command Prompt", and inside nghttp2 directly, run ``cmake``. 3. Then run ``cmake --build`` to build library. 4. nghttp2.dll, nghttp2.lib, nghttp2.exp are placed under lib directory. Note that the above steps most likely produce nghttp2 library only. No bundled applications are compiled. Notes for building on Windows (Mingw/Cygwin) -------------------------------------------- Under Mingw environment, you can only compile the library, it's ``libnghttp2-X.dll`` and ``libnghttp2.a``. If you want to compile the applications(``h2load``, ``nghttp``, ``nghttpx``, ``nghttpd``), you need to use the Cygwin environment. Under Cygwin environment, to compile the applications you need to compile and install the libev first. Secondly, you need to undefine the macro ``__STRICT_ANSI__``, if you not, the functions ``fdopen``, ``fileno`` and ``strptime`` will not available. the sample command like this: .. code-block:: text $ export CFLAGS="-U__STRICT_ANSI__ -I$libev_PREFIX/include -L$libev_PREFIX/lib" $ export CXXFLAGS=$CFLAGS $ ./configure $ make If you want to compile the applications under ``examples/``, you need to remove or rename the ``event.h`` from libev's installation, because it conflicts with libevent's installation. Notes for installation on Linux systems -------------------------------------------- After installing nghttp2 tool suite with ``make install`` one might experience a similar error: .. code-block:: text nghttpx: error while loading shared libraries: libnghttp2.so.14: cannot open shared object file: No such file or directory This means that the tool is unable to locate the ``libnghttp2.so`` shared library. To update the shared library cache run ``sudo ldconfig``. Building the documentation -------------------------- .. note:: Documentation is still incomplete. To build the documentation, run: .. code-block:: text $ make html The documents will be generated under ``doc/manual/html/``. The generated documents will not be installed with ``make install``. The online documentation is available at https://nghttp2.org/documentation/ Build HTTP/3 enabled h2load and nghttpx --------------------------------------- To build h2load and nghttpx with HTTP/3 feature enabled, run the configure script with ``--enable-http3``. For nghttpx to reload configurations and swapping its executable while gracefully terminating old worker processes, eBPF is required. Run the configure script with ``--enable-http3 --with-libbpf`` to build eBPF program. The QUIC keying material must be set with ``--frontend-quic-secret-file`` in order to keep the existing connections alive during reload. The detailed steps to build HTTP/3 enabled h2load and nghttpx follow. Build aws-lc: .. code-block:: text $ git clone --depth 1 -b v1.23.0 https://github.com/aws/aws-lc $ cd aws-lc $ cmake -B build -DDISABLE_GO=ON --install-prefix=$PWD/opt $ make -j$(nproc) -C build $ cmake --install build $ cd .. Build nghttp3: .. code-block:: text $ git clone --depth 1 -b v1.2.0 https://github.com/ngtcp2/nghttp3 $ cd nghttp3 $ git submodule update --init --depth 1 $ autoreconf -i $ ./configure --prefix=$PWD/build --enable-lib-only $ make -j$(nproc) $ make install $ cd .. Build ngtcp2: .. code-block:: text $ git clone --depth 1 -b v1.4.0 https://github.com/ngtcp2/ngtcp2 $ cd ngtcp2 $ git submodule update --init --depth 1 $ autoreconf -i $ ./configure --prefix=$PWD/build --enable-lib-only --with-boringssl \ BORINGSSL_CFLAGS="-I$PWD/../aws-lc/opt/include" \ BORINGSSL_LIBS="-L$PWD/../aws-lc/opt/lib -lssl -lcrypto" $ make -j$(nproc) $ make install $ cd .. If your Linux distribution does not have libbpf-dev >= 0.7.0, build from source: .. code-block:: text $ git clone --depth 1 -b v1.3.0 https://github.com/libbpf/libbpf $ cd libbpf $ PREFIX=$PWD/build make -C src install $ cd .. Build nghttp2: .. code-block:: text $ git clone https://github.com/nghttp2/nghttp2 $ cd nghttp2 $ git submodule update --init $ autoreconf -i $ ./configure --with-mruby --enable-http3 --with-libbpf \ CC=clang-15 CXX=clang++-15 \ PKG_CONFIG_PATH="$PWD/../aws-lc/opt/lib/pkgconfig:$PWD/../nghttp3/build/lib/pkgconfig:$PWD/../ngtcp2/build/lib/pkgconfig:$PWD/../libbpf/build/lib64/pkgconfig" \ LDFLAGS="$LDFLAGS -Wl,-rpath,$PWD/../aws-lc/opt/lib -Wl,-rpath,$PWD/../libbpf/build/lib64" $ make -j$(nproc) The eBPF program ``reuseport_kern.o`` should be found under bpf directory. Pass ``--quic-bpf-program-file=bpf/reuseport_kern.o`` option to nghttpx to load it. See also `HTTP/3 section in nghttpx - HTTP/2 proxy - HOW-TO `_. Unit tests ---------- Unit tests are done by simply running ``make check``. Integration tests ----------------- We have the integration tests for the nghttpx proxy server. The tests are written in the `Go programming language `_ and uses its testing framework. We depend on the following libraries: * golang.org/x/net/http2 * golang.org/x/net/websocket * https://github.com/tatsuhiro-t/go-nghttp2 Go modules will download these dependencies automatically. To run the tests, run the following command under ``integration-tests`` directory: .. code-block:: text $ make it Inside the tests, we use port 3009 to run the test subject server. Migration from v0.7.15 or earlier --------------------------------- nghttp2 v1.0.0 introduced several backward incompatible changes. In this section, we describe these changes and how to migrate to v1.0.0. ALPN protocol ID is now ``h2`` and ``h2c`` ++++++++++++++++++++++++++++++++++++++++++ Previously we announced ``h2-14`` and ``h2c-14``. v1.0.0 implements final protocol version, and we changed ALPN ID to ``h2`` and ``h2c``. The macros ``NGHTTP2_PROTO_VERSION_ID``, ``NGHTTP2_PROTO_VERSION_ID_LEN``, ``NGHTTP2_CLEARTEXT_PROTO_VERSION_ID``, and ``NGHTTP2_CLEARTEXT_PROTO_VERSION_ID_LEN`` have been updated to reflect this change. Basically, existing applications do not have to do anything, just recompiling is enough for this change. Use word "client magic" where we use "client connection preface" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ We use "client connection preface" to mean first 24 bytes of client connection preface. This is technically not correct, since client connection preface is composed of 24 bytes client magic byte string followed by SETTINGS frame. For clarification, we call "client magic" for this 24 bytes byte string and updated API. * ``NGHTTP2_CLIENT_CONNECTION_PREFACE`` was replaced with ``NGHTTP2_CLIENT_MAGIC``. * ``NGHTTP2_CLIENT_CONNECTION_PREFACE_LEN`` was replaced with ``NGHTTP2_CLIENT_MAGIC_LEN``. * ``NGHTTP2_BAD_PREFACE`` was renamed as ``NGHTTP2_BAD_CLIENT_MAGIC`` The already deprecated ``NGHTTP2_CLIENT_CONNECTION_HEADER`` and ``NGHTTP2_CLIENT_CONNECTION_HEADER_LEN`` were removed. If application uses these macros, just replace old ones with new ones. Since v1.0.0, client magic is sent by library (see next subsection), so client application may just remove these macro use. Client magic is sent by library +++++++++++++++++++++++++++++++ Previously nghttp2 library did not send client magic, which is first 24 bytes byte string of client connection preface, and client applications have to send it by themselves. Since v1.0.0, client magic is sent by library via first call of ``nghttp2_session_send()`` or ``nghttp2_session_mem_send2()``. The client applications which send client magic must remove the relevant code. Remove HTTP Alternative Services (Alt-Svc) related code +++++++++++++++++++++++++++++++++++++++++++++++++++++++ Alt-Svc specification is not finalized yet. To make our API stable, we have decided to remove all Alt-Svc related API from nghttp2. * ``NGHTTP2_EXT_ALTSVC`` was removed. * ``nghttp2_ext_altsvc`` was removed. We have already removed the functionality of Alt-Svc in v0.7 series and they have been essentially noop. The application using these macro and struct, remove those lines. Use nghttp2_error in nghttp2_on_invalid_frame_recv_callback +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Previously ``nghttp2_on_invalid_frame_recv_cb_called`` took the ``error_code``, defined in ``nghttp2_error_code``, as parameter. But they are not detailed enough to debug. Therefore, we decided to use more detailed ``nghttp2_error`` values instead. The application using this callback should update the callback signature. If it treats ``error_code`` as HTTP/2 error code, update the code so that it is treated as ``nghttp2_error``. Receive client magic by default +++++++++++++++++++++++++++++++ Previously nghttp2 did not process client magic (24 bytes byte string). To make it deal with it, we had to use ``nghttp2_option_set_recv_client_preface()``. Since v1.0.0, nghttp2 processes client magic by default and ``nghttp2_option_set_recv_client_preface()`` was removed. Some application may want to disable this behaviour, so we added ``nghttp2_option_set_no_recv_client_magic()`` to achieve this. The application using ``nghttp2_option_set_recv_client_preface()`` with nonzero value, just remove it. The application using ``nghttp2_option_set_recv_client_preface()`` with zero value or not using it must use ``nghttp2_option_set_no_recv_client_magic()`` with nonzero value. Client, Server and Proxy programs --------------------------------- The ``src`` directory contains the HTTP/2 client, server and proxy programs. nghttp - client +++++++++++++++ ``nghttp`` is a HTTP/2 client. It can connect to the HTTP/2 server with prior knowledge, HTTP Upgrade and ALPN TLS extension. It has verbose output mode for framing information. Here is sample output from ``nghttp`` client: .. code-block:: text $ nghttp -nv https://nghttp2.org [ 0.190] Connected The negotiated protocol: h2 [ 0.212] recv SETTINGS frame (niv=2) [SETTINGS_MAX_CONCURRENT_STREAMS(0x03):100] [SETTINGS_INITIAL_WINDOW_SIZE(0x04):65535] [ 0.212] send SETTINGS frame (niv=2) [SETTINGS_MAX_CONCURRENT_STREAMS(0x03):100] [SETTINGS_INITIAL_WINDOW_SIZE(0x04):65535] [ 0.212] send SETTINGS frame ; ACK (niv=0) [ 0.212] send PRIORITY frame (dep_stream_id=0, weight=201, exclusive=0) [ 0.212] send PRIORITY frame (dep_stream_id=0, weight=101, exclusive=0) [ 0.212] send PRIORITY frame (dep_stream_id=0, weight=1, exclusive=0) [ 0.212] send PRIORITY frame (dep_stream_id=7, weight=1, exclusive=0) [ 0.212] send PRIORITY frame (dep_stream_id=3, weight=1, exclusive=0) [ 0.212] send HEADERS frame ; END_STREAM | END_HEADERS | PRIORITY (padlen=0, dep_stream_id=11, weight=16, exclusive=0) ; Open new stream :method: GET :path: / :scheme: https :authority: nghttp2.org accept: */* accept-encoding: gzip, deflate user-agent: nghttp2/1.0.1-DEV [ 0.221] recv SETTINGS frame ; ACK (niv=0) [ 0.221] recv (stream_id=13) :method: GET [ 0.221] recv (stream_id=13) :scheme: https [ 0.221] recv (stream_id=13) :path: /stylesheets/screen.css [ 0.221] recv (stream_id=13) :authority: nghttp2.org [ 0.221] recv (stream_id=13) accept-encoding: gzip, deflate [ 0.222] recv (stream_id=13) user-agent: nghttp2/1.0.1-DEV [ 0.222] recv PUSH_PROMISE frame ; END_HEADERS (padlen=0, promised_stream_id=2) [ 0.222] recv (stream_id=13) :status: 200 [ 0.222] recv (stream_id=13) date: Thu, 21 May 2015 16:38:14 GMT [ 0.222] recv (stream_id=13) content-type: text/html [ 0.222] recv (stream_id=13) last-modified: Fri, 15 May 2015 15:38:06 GMT [ 0.222] recv (stream_id=13) etag: W/"555612de-19f6" [ 0.222] recv (stream_id=13) link: ; rel=preload; as=stylesheet [ 0.222] recv (stream_id=13) content-encoding: gzip [ 0.222] recv (stream_id=13) server: nghttpx nghttp2/1.0.1-DEV [ 0.222] recv (stream_id=13) via: 1.1 nghttpx [ 0.222] recv (stream_id=13) strict-transport-security: max-age=31536000 [ 0.222] recv HEADERS frame ; END_HEADERS (padlen=0) ; First response header [ 0.222] recv DATA frame ; END_STREAM [ 0.222] recv (stream_id=2) :status: 200 [ 0.222] recv (stream_id=2) date: Thu, 21 May 2015 16:38:14 GMT [ 0.222] recv (stream_id=2) content-type: text/css [ 0.222] recv (stream_id=2) last-modified: Fri, 15 May 2015 15:38:06 GMT [ 0.222] recv (stream_id=2) etag: W/"555612de-9845" [ 0.222] recv (stream_id=2) content-encoding: gzip [ 0.222] recv (stream_id=2) server: nghttpx nghttp2/1.0.1-DEV [ 0.222] recv (stream_id=2) via: 1.1 nghttpx [ 0.222] recv (stream_id=2) strict-transport-security: max-age=31536000 [ 0.222] recv HEADERS frame ; END_HEADERS (padlen=0) ; First push response header [ 0.228] recv DATA frame ; END_STREAM [ 0.228] send GOAWAY frame (last_stream_id=2, error_code=NO_ERROR(0x00), opaque_data(0)=[]) The HTTP Upgrade is performed like so: .. code-block:: text $ nghttp -nvu http://nghttp2.org [ 0.011] Connected [ 0.011] HTTP Upgrade request GET / HTTP/1.1 Host: nghttp2.org Connection: Upgrade, HTTP2-Settings Upgrade: h2c HTTP2-Settings: AAMAAABkAAQAAP__ Accept: */* User-Agent: nghttp2/1.0.1-DEV [ 0.018] HTTP Upgrade response HTTP/1.1 101 Switching Protocols Connection: Upgrade Upgrade: h2c [ 0.018] HTTP Upgrade success [ 0.018] recv SETTINGS frame (niv=2) [SETTINGS_MAX_CONCURRENT_STREAMS(0x03):100] [SETTINGS_INITIAL_WINDOW_SIZE(0x04):65535] [ 0.018] send SETTINGS frame (niv=2) [SETTINGS_MAX_CONCURRENT_STREAMS(0x03):100] [SETTINGS_INITIAL_WINDOW_SIZE(0x04):65535] [ 0.018] send SETTINGS frame ; ACK (niv=0) [ 0.018] send PRIORITY frame (dep_stream_id=0, weight=201, exclusive=0) [ 0.018] send PRIORITY frame (dep_stream_id=0, weight=101, exclusive=0) [ 0.018] send PRIORITY frame (dep_stream_id=0, weight=1, exclusive=0) [ 0.018] send PRIORITY frame (dep_stream_id=7, weight=1, exclusive=0) [ 0.018] send PRIORITY frame (dep_stream_id=3, weight=1, exclusive=0) [ 0.018] send PRIORITY frame (dep_stream_id=11, weight=16, exclusive=0) [ 0.019] recv (stream_id=1) :method: GET [ 0.019] recv (stream_id=1) :scheme: http [ 0.019] recv (stream_id=1) :path: /stylesheets/screen.css [ 0.019] recv (stream_id=1) host: nghttp2.org [ 0.019] recv (stream_id=1) user-agent: nghttp2/1.0.1-DEV [ 0.019] recv PUSH_PROMISE frame ; END_HEADERS (padlen=0, promised_stream_id=2) [ 0.019] recv (stream_id=1) :status: 200 [ 0.019] recv (stream_id=1) date: Thu, 21 May 2015 16:39:16 GMT [ 0.019] recv (stream_id=1) content-type: text/html [ 0.019] recv (stream_id=1) content-length: 6646 [ 0.019] recv (stream_id=1) last-modified: Fri, 15 May 2015 15:38:06 GMT [ 0.019] recv (stream_id=1) etag: "555612de-19f6" [ 0.019] recv (stream_id=1) link: ; rel=preload; as=stylesheet [ 0.019] recv (stream_id=1) accept-ranges: bytes [ 0.019] recv (stream_id=1) server: nghttpx nghttp2/1.0.1-DEV [ 0.019] recv (stream_id=1) via: 1.1 nghttpx [ 0.019] recv HEADERS frame ; END_HEADERS (padlen=0) ; First response header [ 0.019] recv DATA frame ; END_STREAM [ 0.019] recv (stream_id=2) :status: 200 [ 0.019] recv (stream_id=2) date: Thu, 21 May 2015 16:39:16 GMT [ 0.019] recv (stream_id=2) content-type: text/css [ 0.019] recv (stream_id=2) content-length: 38981 [ 0.019] recv (stream_id=2) last-modified: Fri, 15 May 2015 15:38:06 GMT [ 0.019] recv (stream_id=2) etag: "555612de-9845" [ 0.019] recv (stream_id=2) accept-ranges: bytes [ 0.019] recv (stream_id=2) server: nghttpx nghttp2/1.0.1-DEV [ 0.019] recv (stream_id=2) via: 1.1 nghttpx [ 0.019] recv HEADERS frame ; END_HEADERS (padlen=0) ; First push response header [ 0.026] recv DATA frame [ 0.027] recv DATA frame [ 0.027] send WINDOW_UPDATE frame (window_size_increment=33343) [ 0.032] send WINDOW_UPDATE frame (window_size_increment=33707) [ 0.032] recv DATA frame ; END_STREAM [ 0.032] recv SETTINGS frame ; ACK (niv=0) [ 0.032] send GOAWAY frame (last_stream_id=2, error_code=NO_ERROR(0x00), opaque_data(0)=[]) Using the ``-s`` option, ``nghttp`` prints out some timing information for requests, sorted by completion time: .. code-block:: text $ nghttp -nas https://nghttp2.org/ ***** Statistics ***** Request timing: responseEnd: the time when last byte of response was received relative to connectEnd requestStart: the time just before first byte of request was sent relative to connectEnd. If '*' is shown, this was pushed by server. process: responseEnd - requestStart code: HTTP status code size: number of bytes received as response body without inflation. URI: request URI see http://www.w3.org/TR/resource-timing/#processing-model sorted by 'complete' id responseEnd requestStart process code size request path 13 +37.19ms +280us 36.91ms 200 2K / 2 +72.65ms * +36.38ms 36.26ms 200 8K /stylesheets/screen.css 17 +77.43ms +38.67ms 38.75ms 200 3K /javascripts/octopress.js 15 +78.12ms +38.66ms 39.46ms 200 3K /javascripts/modernizr-2.0.js Using the ``-r`` option, ``nghttp`` writes more detailed timing data to the given file in HAR format. nghttpd - server ++++++++++++++++ ``nghttpd`` is a multi-threaded static web server. By default, it uses SSL/TLS connection. Use ``--no-tls`` option to disable it. ``nghttpd`` only accepts HTTP/2 connections via ALPN or direct HTTP/2 connections. No HTTP Upgrade is supported. The ``-p`` option allows users to configure server push. Just like ``nghttp``, it has a verbose output mode for framing information. Here is sample output from ``nghttpd``: .. code-block:: text $ nghttpd --no-tls -v 8080 IPv4: listen 0.0.0.0:8080 IPv6: listen :::8080 [id=1] [ 1.521] send SETTINGS frame (niv=1) [SETTINGS_MAX_CONCURRENT_STREAMS(0x03):100] [id=1] [ 1.521] recv SETTINGS frame (niv=2) [SETTINGS_MAX_CONCURRENT_STREAMS(0x03):100] [SETTINGS_INITIAL_WINDOW_SIZE(0x04):65535] [id=1] [ 1.521] recv SETTINGS frame ; ACK (niv=0) [id=1] [ 1.521] recv PRIORITY frame (dep_stream_id=0, weight=201, exclusive=0) [id=1] [ 1.521] recv PRIORITY frame (dep_stream_id=0, weight=101, exclusive=0) [id=1] [ 1.521] recv PRIORITY frame (dep_stream_id=0, weight=1, exclusive=0) [id=1] [ 1.521] recv PRIORITY frame (dep_stream_id=7, weight=1, exclusive=0) [id=1] [ 1.521] recv PRIORITY frame (dep_stream_id=3, weight=1, exclusive=0) [id=1] [ 1.521] recv (stream_id=13) :method: GET [id=1] [ 1.521] recv (stream_id=13) :path: / [id=1] [ 1.521] recv (stream_id=13) :scheme: http [id=1] [ 1.521] recv (stream_id=13) :authority: localhost:8080 [id=1] [ 1.521] recv (stream_id=13) accept: */* [id=1] [ 1.521] recv (stream_id=13) accept-encoding: gzip, deflate [id=1] [ 1.521] recv (stream_id=13) user-agent: nghttp2/1.0.0-DEV [id=1] [ 1.521] recv HEADERS frame ; END_STREAM | END_HEADERS | PRIORITY (padlen=0, dep_stream_id=11, weight=16, exclusive=0) ; Open new stream [id=1] [ 1.521] send SETTINGS frame ; ACK (niv=0) [id=1] [ 1.521] send HEADERS frame ; END_HEADERS (padlen=0) ; First response header :status: 200 server: nghttpd nghttp2/1.0.0-DEV content-length: 10 cache-control: max-age=3600 date: Fri, 15 May 2015 14:49:04 GMT last-modified: Tue, 30 Sep 2014 12:40:52 GMT [id=1] [ 1.522] send DATA frame ; END_STREAM [id=1] [ 1.522] stream_id=13 closed [id=1] [ 1.522] recv GOAWAY frame (last_stream_id=0, error_code=NO_ERROR(0x00), opaque_data(0)=[]) [id=1] [ 1.522] closed nghttpx - proxy +++++++++++++++ ``nghttpx`` is a multi-threaded reverse proxy for HTTP/3, HTTP/2, and HTTP/1.1, and powers http://nghttp2.org and supports HTTP/2 server push. We reworked ``nghttpx`` command-line interface, and as a result, there are several incompatibles from 1.8.0 or earlier. This is necessary to extend its capability, and secure the further feature enhancements in the future release. Please read `Migration from nghttpx v1.8.0 or earlier `_ to know how to migrate from earlier releases. ``nghttpx`` implements `important performance-oriented features `_ in TLS, such as session IDs, session tickets (with automatic key rotation), OCSP stapling, dynamic record sizing, ALPN, forward secrecy and HTTP/2. ``nghttpx`` also offers the functionality to share session cache and ticket keys among multiple ``nghttpx`` instances via memcached. ``nghttpx`` has 2 operation modes: ================== ======================== ================ ============= Mode option Frontend Backend Note ================== ======================== ================ ============= default mode HTTP/3, HTTP/2, HTTP/1.1 HTTP/1.1, HTTP/2 Reverse proxy ``--http2-proxy`` HTTP/3, HTTP/2, HTTP/1.1 HTTP/1.1, HTTP/2 Forward proxy ================== ======================== ================ ============= The interesting mode at the moment is the default mode. It works like a reverse proxy and listens for HTTP/3, HTTP/2, and HTTP/1.1 and can be deployed as a SSL/TLS terminator for existing web server. In all modes, the frontend connections are encrypted by SSL/TLS by default. To disable encryption, use the ``no-tls`` keyword in ``--frontend`` option. If encryption is disabled, incoming HTTP/1.1 connections can be upgraded to HTTP/2 through HTTP Upgrade. On the other hard, backend connections are not encrypted by default. To encrypt backend connections, use ``tls`` keyword in ``--backend`` option. ``nghttpx`` supports a configuration file. See the ``--conf`` option and sample configuration file ``nghttpx.conf.sample``. In the default mode, ``nghttpx`` works as reverse proxy to the backend server: .. code-block:: text Client <-- (HTTP/3, HTTP/2, HTTP/1.1) --> nghttpx <-- (HTTP/1.1, HTTP/2) --> Web Server [reverse proxy] With the ``--http2-proxy`` option, it works as forward proxy, and it is so called secure HTTP/2 proxy: .. code-block:: text Client <-- (HTTP/3, HTTP/2, HTTP/1.1) --> nghttpx <-- (HTTP/1.1) --> Proxy [secure proxy] (e.g., Squid, ATS) The ``Client`` in the above example needs to be configured to use ``nghttpx`` as secure proxy. At the time of this writing, both Chrome and Firefox support secure HTTP/2 proxy. One way to configure Chrome to use a secure proxy is to create a proxy.pac script like this: .. code-block:: javascript function FindProxyForURL(url, host) { return "HTTPS SERVERADDR:PORT"; } ``SERVERADDR`` and ``PORT`` is the hostname/address and port of the machine nghttpx is running on. Please note that Chrome requires a valid certificate for secure proxy. Then run Chrome with the following arguments: .. code-block:: text $ google-chrome --proxy-pac-url=file:///path/to/proxy.pac --use-npn The backend HTTP/2 connections can be tunneled through an HTTP proxy. The proxy is specified using ``--backend-http-proxy-uri``. The following figure illustrates how nghttpx talks to the outside HTTP/2 proxy through an HTTP proxy: .. code-block:: text Client <-- (HTTP/3, HTTP/2, HTTP/1.1) --> nghttpx <-- (HTTP/2) -- --===================---> HTTP/2 Proxy (HTTP proxy tunnel) (e.g., nghttpx -s) Benchmarking tool ----------------- The ``h2load`` program is a benchmarking tool for HTTP/3, HTTP/2, and HTTP/1.1. The UI of ``h2load`` is heavily inspired by ``weighttp`` (https://github.com/lighttpd/weighttp). The typical usage is as follows: .. code-block:: text $ h2load -n100000 -c100 -m100 https://localhost:8443/ starting benchmark... spawning thread #0: 100 concurrent clients, 100000 total requests Protocol: TLSv1.2 Cipher: ECDHE-RSA-AES128-GCM-SHA256 Server Temp Key: ECDH P-256 256 bits progress: 10% done progress: 20% done progress: 30% done progress: 40% done progress: 50% done progress: 60% done progress: 70% done progress: 80% done progress: 90% done progress: 100% done finished in 771.26ms, 129658 req/s, 4.71MB/s requests: 100000 total, 100000 started, 100000 done, 100000 succeeded, 0 failed, 0 errored status codes: 100000 2xx, 0 3xx, 0 4xx, 0 5xx traffic: 3812300 bytes total, 1009900 bytes headers, 1000000 bytes data min max mean sd +/- sd time for request: 25.12ms 124.55ms 51.07ms 15.36ms 84.87% time for connect: 208.94ms 254.67ms 241.38ms 7.95ms 63.00% time to 1st byte: 209.11ms 254.80ms 241.51ms 7.94ms 63.00% The above example issued total 100,000 requests, using 100 concurrent clients (in other words, 100 HTTP/2 sessions), and a maximum of 100 streams per client. With the ``-t`` option, ``h2load`` will use multiple native threads to avoid saturating a single core on client side. .. warning:: **Don't use this tool against publicly available servers.** That is considered a DOS attack. Please only use it against your private servers. If the experimental HTTP/3 is enabled, h2load can send requests to HTTP/3 server. To do this, specify ``h3`` to ``--alpn-list`` option like so: .. code-block:: text $ h2load --alpn-list h3 https://127.0.0.1:4433 For nghttp2 v1.58 or earlier, use ``--npn-list`` instead of ``--alpn-list``. HPACK tools ----------- The ``src`` directory contains the HPACK tools. The ``deflatehd`` program is a command-line header compression tool. The ``inflatehd`` program is a command-line header decompression tool. Both tools read input from stdin and write output to stdout. Errors are written to stderr. They take JSON as input and output. We (mostly) use the same JSON data format described at https://github.com/http2jp/hpack-test-case. deflatehd - header compressor +++++++++++++++++++++++++++++ The ``deflatehd`` program reads JSON data or HTTP/1-style header fields from stdin and outputs compressed header block in JSON. For the JSON input, the root JSON object must include a ``cases`` key. Its value has to include the sequence of input header set. They share the same compression context and are processed in the order they appear. Each item in the sequence is a JSON object and it must include a ``headers`` key. Its value is an array of JSON objects, which includes exactly one name/value pair. Example: .. code-block:: json { "cases": [ { "headers": [ { ":method": "GET" }, { ":path": "/" } ] }, { "headers": [ { ":method": "POST" }, { ":path": "/" } ] } ] } With the ``-t`` option, the program can accept more familiar HTTP/1 style header field blocks. Each header set is delimited by an empty line: Example: .. code-block:: text :method: GET :scheme: https :path: / :method: POST user-agent: nghttp2 The output is in JSON object. It should include a ``cases`` key and its value is an array of JSON objects, which has at least the following keys: seq The index of header set in the input. input_length The sum of the length of the name/value pairs in the input. output_length The length of the compressed header block. percentage_of_original_size ``output_length`` / ``input_length`` * 100 wire The compressed header block as a hex string. headers The input header set. header_table_size The header table size adjusted before deflating the header set. Examples: .. code-block:: json { "cases": [ { "seq": 0, "input_length": 66, "output_length": 20, "percentage_of_original_size": 30.303030303030305, "wire": "01881f3468e5891afcbf83868a3d856659c62e3f", "headers": [ { ":authority": "example.org" }, { ":method": "GET" }, { ":path": "/" }, { ":scheme": "https" }, { "user-agent": "nghttp2" } ], "header_table_size": 4096 } , { "seq": 1, "input_length": 74, "output_length": 10, "percentage_of_original_size": 13.513513513513514, "wire": "88448504252dd5918485", "headers": [ { ":authority": "example.org" }, { ":method": "POST" }, { ":path": "/account" }, { ":scheme": "https" }, { "user-agent": "nghttp2" } ], "header_table_size": 4096 } ] } The output can be used as the input for ``inflatehd`` and ``deflatehd``. With the ``-d`` option, the extra ``header_table`` key is added and its associated value includes the state of dynamic header table after the corresponding header set was processed. The value includes at least the following keys: entries The entry in the header table. If ``referenced`` is ``true``, it is in the reference set. The ``size`` includes the overhead (32 bytes). The ``index`` corresponds to the index of header table. The ``name`` is the header field name and the ``value`` is the header field value. size The sum of the spaces entries occupied, this includes the entry overhead. max_size The maximum header table size. deflate_size The sum of the spaces entries occupied within ``max_deflate_size``. max_deflate_size The maximum header table size the encoder uses. This can be smaller than ``max_size``. In this case, the encoder only uses up to first ``max_deflate_size`` buffer. Since the header table size is still ``max_size``, the encoder has to keep track of entries outside the ``max_deflate_size`` but inside the ``max_size`` and make sure that they are no longer referenced. Example: .. code-block:: json { "cases": [ { "seq": 0, "input_length": 66, "output_length": 20, "percentage_of_original_size": 30.303030303030305, "wire": "01881f3468e5891afcbf83868a3d856659c62e3f", "headers": [ { ":authority": "example.org" }, { ":method": "GET" }, { ":path": "/" }, { ":scheme": "https" }, { "user-agent": "nghttp2" } ], "header_table_size": 4096, "header_table": { "entries": [ { "index": 1, "name": "user-agent", "value": "nghttp2", "referenced": true, "size": 49 }, { "index": 2, "name": ":scheme", "value": "https", "referenced": true, "size": 44 }, { "index": 3, "name": ":path", "value": "/", "referenced": true, "size": 38 }, { "index": 4, "name": ":method", "value": "GET", "referenced": true, "size": 42 }, { "index": 5, "name": ":authority", "value": "example.org", "referenced": true, "size": 53 } ], "size": 226, "max_size": 4096, "deflate_size": 226, "max_deflate_size": 4096 } } , { "seq": 1, "input_length": 74, "output_length": 10, "percentage_of_original_size": 13.513513513513514, "wire": "88448504252dd5918485", "headers": [ { ":authority": "example.org" }, { ":method": "POST" }, { ":path": "/account" }, { ":scheme": "https" }, { "user-agent": "nghttp2" } ], "header_table_size": 4096, "header_table": { "entries": [ { "index": 1, "name": ":method", "value": "POST", "referenced": true, "size": 43 }, { "index": 2, "name": "user-agent", "value": "nghttp2", "referenced": true, "size": 49 }, { "index": 3, "name": ":scheme", "value": "https", "referenced": true, "size": 44 }, { "index": 4, "name": ":path", "value": "/", "referenced": false, "size": 38 }, { "index": 5, "name": ":method", "value": "GET", "referenced": false, "size": 42 }, { "index": 6, "name": ":authority", "value": "example.org", "referenced": true, "size": 53 } ], "size": 269, "max_size": 4096, "deflate_size": 269, "max_deflate_size": 4096 } } ] } inflatehd - header decompressor +++++++++++++++++++++++++++++++ The ``inflatehd`` program reads JSON data from stdin and outputs decompressed name/value pairs in JSON. The root JSON object must include the ``cases`` key. Its value has to include the sequence of compressed header blocks. They share the same compression context and are processed in the order they appear. Each item in the sequence is a JSON object and it must have at least a ``wire`` key. Its value is a compressed header block as a hex string. Example: .. code-block:: json { "cases": [ { "wire": "8285" }, { "wire": "8583" } ] } The output is a JSON object. It should include a ``cases`` key and its value is an array of JSON objects, which has at least following keys: seq The index of the header set in the input. headers A JSON array that includes decompressed name/value pairs. wire The compressed header block as a hex string. header_table_size The header table size adjusted before inflating compressed header block. Example: .. code-block:: json { "cases": [ { "seq": 0, "wire": "01881f3468e5891afcbf83868a3d856659c62e3f", "headers": [ { ":authority": "example.org" }, { ":method": "GET" }, { ":path": "/" }, { ":scheme": "https" }, { "user-agent": "nghttp2" } ], "header_table_size": 4096 } , { "seq": 1, "wire": "88448504252dd5918485", "headers": [ { ":method": "POST" }, { ":path": "/account" }, { "user-agent": "nghttp2" }, { ":scheme": "https" }, { ":authority": "example.org" } ], "header_table_size": 4096 } ] } The output can be used as the input for ``deflatehd`` and ``inflatehd``. With the ``-d`` option, the extra ``header_table`` key is added and its associated value includes the state of the dynamic header table after the corresponding header set was processed. The format is the same as ``deflatehd``. Contribution ------------ [This text was composed based on 1.2. License section of curl/libcurl project.] When contributing with code, you agree to put your changes and new code under the same license nghttp2 is already using unless stated and agreed otherwise. When changing existing source code, do not alter the copyright of the original file(s). The copyright will still be owned by the original creator(s) or those who have been assigned copyright by the original author(s). By submitting a patch to the nghttp2 project, you (or your employer, as the case may be) agree to assign the copyright of your submission to us. .. the above really needs to be reworded to pass legal muster. We will credit you for your changes as far as possible, to give credit but also to keep a trace back to who made what changes. Please always provide us with your full real name when contributing! See `Contribution Guidelines `_ for more details. Versioning ---------- In general, we follow `Semantic Versioning `_. We may release PATCH releases between the regular releases, mainly for severe security bug fixes. We have no plan to break API compatibility changes involving soname bump, so MAJOR version will stay 1 for the foreseeable future. License ------- The MIT License PKn;iZ>~:##nghttp2/fetch-ocsp-responsenuȯ#!/usr/bin/env python # -*- coding: utf-8 -*- # nghttp2 - HTTP/2 C Library # Copyright (c) 2015 Tatsuhiro Tsujikawa # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, # distribute, sublicense, and/or sell copies of the Software, and to # permit persons to whom the Software is furnished to do so, subject to # the following conditions: # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # This program was translated from the program originally developed by # h2o project (https://github.com/h2o/h2o), written in Perl. It had # the following copyright notice: # Copyright (c) 2015 DeNA Co., Ltd. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. from __future__ import unicode_literals import argparse import io import os import os.path import re import shutil import subprocess import sys import tempfile # make this program work for both Python 3 and Python 2. try: from urllib.parse import urlparse stdout_bwrite = sys.stdout.buffer.write except ImportError: from urlparse import urlparse stdout_bwrite = sys.stdout.write def die(msg): sys.stderr.write(msg) sys.stderr.write('\n') sys.exit(255) def tempfail(msg): sys.stderr.write(msg) sys.stderr.write('\n') sys.exit(os.EX_TEMPFAIL) def run_openssl(args, allow_tempfail=False): buf = io.BytesIO() try: p = subprocess.Popen(args, stdout=subprocess.PIPE) except Exception as e: die('failed to invoke {}:{}'.format(args, e)) try: while True: data = p.stdout.read() if len(data) == 0: break buf.write(data) if p.wait() != 0: raise Exception('nonzero return code {}'.format(p.returncode)) return buf.getvalue() except Exception as e: msg = 'OpenSSL exited abnormally: {}:{}'.format(args, e) tempfail(msg) if allow_tempfail else die(msg) def read_file(path): with open(path, 'rb') as f: return f.read() def write_file(path, data): with open(path, 'wb') as f: f.write(data) def detect_openssl_version(cmd): return run_openssl([cmd, 'version']).decode('utf-8').strip() def extract_ocsp_uri(cmd, cert_fn): # obtain ocsp uri ocsp_uri = run_openssl( [cmd, 'x509', '-in', cert_fn, '-noout', '-ocsp_uri']).decode('utf-8').strip() if not re.match(r'^https?://', ocsp_uri): die('failed to extract ocsp URI from {}'.format(cert_fn)) return ocsp_uri def save_issuer_certificate(issuer_fn, cert_fn): # save issuer certificate chain = read_file(cert_fn).decode('utf-8') m = re.match( r'.*?-----END CERTIFICATE-----.*?(-----BEGIN CERTIFICATE-----.*?-----END CERTIFICATE-----)', chain, re.DOTALL) if not m: die('--issuer option was not used, and failed to extract issuer certificate from the certificate') write_file(issuer_fn, (m.group(1) + '\n').encode('utf-8')) def send_and_receive_ocsp(respder_fn, cmd, cert_fn, issuer_fn, ocsp_uri, ocsp_host, openssl_version): # obtain response (without verification) sys.stderr.write('sending OCSP request to {}\n'.format(ocsp_uri)) args = [ cmd, 'ocsp', '-issuer', issuer_fn, '-cert', cert_fn, '-url', ocsp_uri, '-noverify', '-respout', respder_fn ] ver = openssl_version.lower() if ver.startswith('openssl 1.0.') or ver.startswith('libressl '): args.extend(['-header', 'Host', ocsp_host]) resp = run_openssl(args, allow_tempfail=True) return resp.decode('utf-8') def verify_response(cmd, tempdir, issuer_fn, respder_fn): # verify the response sys.stderr.write('verifying the response signature\n') verify_fn = os.path.join(tempdir, 'verify.out') # try from exotic options allextra = [ # for comodo ['-VAfile', issuer_fn], # these options are only available in OpenSSL >= 1.0.2 ['-partial_chain', '-trusted_first', '-CAfile', issuer_fn], # for OpenSSL <= 1.0.1 ['-CAfile', issuer_fn], ] for extra in allextra: with open(verify_fn, 'w+b') as f: args = [cmd, 'ocsp', '-respin', respder_fn] args.extend(extra) p = subprocess.Popen(args, stdout=f, stderr=f) if p.wait() == 0: # OpenSSL <= 1.0.1, openssl ocsp still returns exit # code 0 even if verification was failed. So check # the error message in stderr output. f.seek(0) if f.read().decode('utf-8').find( 'Response Verify Failure') != -1: continue sys.stderr.write('verify OK (used: {})\n'.format(extra)) return True sys.stderr.write(read_file(verify_fn).decode('utf-8')) return False def fetch_ocsp_response(cmd, cert_fn, tempdir, issuer_fn=None): openssl_version = detect_openssl_version(cmd) sys.stderr.write( 'fetch-ocsp-response (using {})\n'.format(openssl_version)) ocsp_uri = extract_ocsp_uri(cmd, cert_fn) ocsp_host = urlparse(ocsp_uri).netloc if not issuer_fn: issuer_fn = os.path.join(tempdir, 'issuer.crt') save_issuer_certificate(issuer_fn, cert_fn) respder_fn = os.path.join(tempdir, 'resp.der') resp = send_and_receive_ocsp( respder_fn, cmd, cert_fn, issuer_fn, ocsp_uri, ocsp_host, openssl_version) sys.stderr.write('{}\n'.format(resp)) # OpenSSL 1.0.2 still returns exit code 0 even if ocsp responder # returned error status (e.g., trylater(3)) if resp.find('Responder Error:') != -1: raise Exception('responder returned error') if not verify_response(cmd, tempdir, issuer_fn, respder_fn): tempfail('failed to verify the response') # success res = read_file(respder_fn) stdout_bwrite(res) if __name__ == '__main__': parser = argparse.ArgumentParser( description= '''The command issues an OCSP request for given server certificate, verifies the response and prints the resulting DER.''', epilog= '''The command exits 0 if successful, or 75 (EX_TEMPFAIL) on temporary error. Other exit codes may be returned in case of hard errors.''') parser.add_argument( '--issuer', metavar='FILE', help= 'issuer certificate (if omitted, is extracted from the certificate chain)') parser.add_argument('--openssl', metavar='CMD', help='openssl command to use (default: "openssl")', default='openssl') parser.add_argument('certificate', help='path to certificate file to validate') args = parser.parse_args() tempdir = None try: # Python3.2 has tempfile.TemporaryDirectory, which has nice # feature to delete its tree by cleanup() function. We have # to support Python2.7, so we have to do this manually. tempdir = tempfile.mkdtemp() fetch_ocsp_response(args.openssl, args.certificate, tempdir, args.issuer) finally: if tempdir: shutil.rmtree(tempdir) PK\|;`. When in doubt, quote the URL. An example that would invoke a remote CGI that uses &-symbols could be: curl 'http://www.example.com/cgi-bin/query?text=yes&q=curl' In Windows, the standard DOS shell treats the percent sign specially and you need to use TWO percent signs for each single one you want to use in the URL. If you want a literal percent sign to be part of the data you pass in a POST using -d/--data you must encode it as '%25' (which then also needs the percent sign doubled on Windows machines). 4.3 How can I use {, }, [ or ] to specify multiple URLs? Because those letters have a special meaning to the shell, to be used in a URL specified to curl you must quote them. An example that downloads two URLs (sequentially) would be: curl '{curl,www}.haxx.se' To be able to use those characters as actual parts of the URL (without using them for the curl URL "globbing" system), use the -g/--globoff option: curl -g 'www.example.com/weirdname[].html' 4.4 Why do I get downloaded data even though the web page does not exist? curl asks remote servers for the page you specify. If the page does not exist at the server, the HTTP protocol defines how the server should respond and that means that headers and a "page" will be returned. That is simply how HTTP works. By using the --fail option you can tell curl explicitly to not get any data if the HTTP return code does not say success. 4.5 Why do I get return code XXX from an HTTP server? RFC 2616 clearly explains the return codes. This is a short transcript. Go read the RFC for exact details: 4.5.1 "400 Bad Request" The request could not be understood by the server due to malformed syntax. The client SHOULD NOT repeat the request without modifications. 4.5.2 "401 Unauthorized" The request requires user authentication. 4.5.3 "403 Forbidden" The server understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated. 4.5.4 "404 Not Found" The server has not found anything matching the Request-URI. No indication is given as to whether the condition is temporary or permanent. 4.5.5 "405 Method Not Allowed" The method specified in the Request-Line is not allowed for the resource identified by the Request-URI. The response MUST include an Allow header containing a list of valid methods for the requested resource. 4.5.6 "301 Moved Permanently" If you get this return code and an HTML output similar to this:

Moved Permanently

The document has moved here. it might be because you requested a directory URL but without the trailing slash. Try the same operation again _with_ the trailing URL, or use the -L/--location option to follow the redirection. 4.6 Can you tell me what error code 142 means? All curl error codes are described at the end of the man page, in the section called "EXIT CODES". Error codes that are larger than the highest documented error code means that curl has exited due to a crash. This is a serious error, and we appreciate a detailed bug report from you that describes how we could go ahead and repeat this. 4.7 How do I keep user names and passwords secret in curl command lines? This problem has two sides: The first part is to avoid having clear-text passwords in the command line so that they do not appear in 'ps' outputs and similar. That is easily avoided by using the "-K" option to tell curl to read parameters from a file or stdin to which you can pass the secret info. curl itself will also attempt to "hide" the given password by blanking out the option - this does not work on all platforms. To keep the passwords in your account secret from the rest of the world is not a task that curl addresses. You could of course encrypt them somehow to at least hide them from being read by human eyes, but that is not what anyone would call security. Also note that regular HTTP (using Basic authentication) and FTP passwords are sent as cleartext across the network. All it takes for anyone to fetch them is to listen on the network. Eavesdropping is easy. Use more secure authentication methods (like Digest, Negotiate or even NTLM) or consider the SSL-based alternatives HTTPS and FTPS. 4.8 I found a bug It is not a bug if the behavior is documented. Read the docs first. Especially check out the KNOWN_BUGS file, it may be a documented bug. If it is a problem with a binary you have downloaded or a package for your particular platform, try contacting the person who built the package/archive you have. If there is a bug, read the BUGS document first. Then report it as described in there. 4.9 curl cannot authenticate to a server that requires NTLM? NTLM support requires OpenSSL, GnuTLS, mbedTLS, Secure Transport, or Microsoft Windows libraries at build-time to provide this functionality. 4.10 My HTTP request using HEAD, PUT or DELETE does not work Many web servers allow or demand that the administrator configures the server properly for these requests to work on the web server. Some servers seem to support HEAD only on certain kinds of URLs. To fully grasp this, try the documentation for the particular server software you are trying to interact with. This is not anything curl can do anything about. 4.11 Why do my HTTP range requests return the full document? Because the range may not be supported by the server, or the server may choose to ignore it and return the full document anyway. 4.12 Why do I get "certificate verify failed" ? When you invoke curl and get an error 60 error back it means that curl could not verify that the server's certificate was good. curl verifies the certificate using the CA cert bundle and verifying for which names the certificate has been granted. To completely disable the certificate verification, use -k. This does however enable man-in-the-middle attacks and makes the transfer INSECURE. We strongly advise against doing this for more than experiments. If you get this failure with a CA cert bundle installed and used, the server's certificate might not be signed by one of the CA's in your CA store. It might for example be self-signed. You then correct this problem by obtaining a valid CA cert for the server. Or again, decrease the security by disabling this check. At times, you find that the verification works in your favorite browser but fails in curl. When this happens, the reason is usually that the server sends an incomplete cert chain. The server is mandated to send all "intermediate certificates" but does not. This typically works with browsers anyway since they A) cache such certs and B) supports AIA which downloads such missing certificates on demand. This is a server misconfiguration. A good way to figure out if this is the case it to use the SSL Labs server test and check the certificate chain: https://www.ssllabs.com/ssltest/ Details are also in the SSLCERTS.md document, found online here: https://curl.se/docs/sslcerts.html 4.13 Why is curl -R on Windows one hour off? Since curl 7.53.0 this issue should be fixed as long as curl was built with any modern compiler that allows for a 64-bit curl_off_t type. For older compilers or prior curl versions it may set a time that appears one hour off. This happens due to a flaw in how Windows stores and uses file modification times and it is not easily worked around. For more details read this: https://www.codeproject.com/Articles/1144/Beating-the-Daylight-Savings-Time-bug-and-getting 4.14 Redirects work in browser but not with curl curl supports HTTP redirects well (see item 3.8). Browsers generally support at least two other ways to perform redirects that curl does not: Meta tags. You can write an HTML tag that will cause the browser to redirect to another given URL after a certain time. JavaScript. You can write a JavaScript program embedded in an HTML page that redirects the browser to another given URL. There is no way to make curl follow these redirects. You must either manually figure out what the page is set to do, or write a script that parses the results and fetches the new URL. 4.15 FTPS does not work curl supports FTPS (sometimes known as FTP-SSL) both implicit and explicit mode. When a URL is used that starts with FTPS://, curl assumes implicit SSL on the control connection and will therefore immediately connect and try to speak SSL. FTPS:// connections default to port 990. To use explicit FTPS, you use an FTP:// URL and the --ftp-ssl option (or one of its related flavors). This is the most common method, and the one mandated by RFC 4217. This kind of connection will then of course use the standard FTP port 21 by default. 4.16 My HTTP POST or PUT requests are slow libcurl makes all POST and PUT requests (except for requests with a small request body) use the "Expect: 100-continue" header. This header allows the server to deny the operation early so that libcurl can bail out before having to send any data. This is useful in authentication cases and others. However, many servers do not implement the Expect: stuff properly and if the server does not respond (positively) within 1 second libcurl will continue and send off the data anyway. You can disable libcurl's use of the Expect: header the same way you disable any header, using -H / CURLOPT_HTTPHEADER, or by forcing it to use HTTP 1.0. 4.17 Non-functional connect timeouts In most Windows setups having a timeout longer than 21 seconds make no difference, as it will only send 3 TCP SYN packets and no more. The second packet sent three seconds after the first and the third six seconds after the second. No more than three packets are sent, no matter how long the timeout is set. See option TcpMaxConnectRetransmissions on this page: https://support.microsoft.com/en-us/kb/175523/en-us Also, even on non-Windows systems there may run a firewall or anti-virus software or similar that accepts the connection but does not actually do anything else. This will make (lib)curl to consider the connection connected and thus the connect timeout will not trigger. 4.18 file:// URLs containing drive letters (Windows, NetWare) When using curl to try to download a local file, one might use a URL in this format: file://D:/blah.txt you will find that even if D:\blah.txt does exist, curl returns a 'file not found' error. According to RFC 1738 (https://www.ietf.org/rfc/rfc1738.txt), file:// URLs must contain a host component, but it is ignored by most implementations. In the above example, 'D:' is treated as the host component, and is taken away. Thus, curl tries to open '/blah.txt'. If your system is installed to drive C:, that will resolve to 'C:\blah.txt', and if that does not exist you will get the not found error. To fix this problem, use file:// URLs with *three* leading slashes: file:///D:/blah.txt Alternatively, if it makes more sense, specify 'localhost' as the host component: file://localhost/D:/blah.txt In either case, curl should now be looking for the correct file. 4.19 Why does not curl return an error when the network cable is unplugged? Unplugging a cable is not an error situation. The TCP/IP protocol stack was designed to be fault tolerant, so even though there may be a physical break somewhere the connection should not be affected, just possibly delayed. Eventually, the physical break will be fixed or the data will be re-routed around the physical problem through another path. In such cases, the TCP/IP stack is responsible for detecting when the network connection is irrevocably lost. Since with some protocols it is perfectly legal for the client to wait indefinitely for data, the stack may never report a problem, and even when it does, it can take up to 20 minutes for it to detect an issue. The curl option --keepalive-time enables keep-alive support in the TCP/IP stack which makes it periodically probe the connection to make sure it is still available to send data. That should reliably detect any TCP/IP network failure. TCP keep alive will not detect the network going down before the TCP/IP connection is established (e.g. during a DNS lookup) or using protocols that do not use TCP. To handle those situations, curl offers a number of timeouts on its own. --speed-limit/--speed-time will abort if the data transfer rate falls too low, and --connect-timeout and --max-time can be used to put an overall timeout on the connection phase or the entire transfer. A libcurl-using application running in a known physical environment (e.g. an embedded device with only a single network connection) may want to act immediately if its lone network connection goes down. That can be achieved by having the application monitor the network connection on its own using an OS-specific mechanism, then signaling libcurl to abort (see also item 5.13). 4.20 curl does not return error for HTTP non-200 responses Correct. Unless you use -f (--fail). When doing HTTP transfers, curl will perform exactly what you are asking it to do and if successful it will not return an error. You can use curl to test your web server's "file not found" page (that gets 404 back), you can use it to check your authentication protected web pages (that gets a 401 back) and so on. The specific HTTP response code does not constitute a problem or error for curl. It simply sends and delivers HTTP as you asked and if that worked, everything is fine and dandy. The response code is generally providing more higher level error information that curl does not care about. The error was not in the HTTP transfer. If you want your command line to treat error codes in the 400 and up range as errors and thus return a non-zero value and possibly show an error message, curl has a dedicated option for that: -f (CURLOPT_FAILONERROR in libcurl speak). You can also use the -w option and the variable %{response_code} to extract the exact response code that was returned in the response. 5. libcurl Issues 5.1 Is libcurl thread-safe? Yes. We have written the libcurl code specifically adjusted for multi-threaded programs. libcurl will use thread-safe functions instead of non-safe ones if your system has such. Note that you must never share the same handle in multiple threads. There may be some exceptions to thread safety depending on how libcurl was built. Please review the guidelines for thread safety to learn more: https://curl.se/libcurl/c/threadsafe.html 5.2 How can I receive all data into a large memory chunk? [ See also the examples/getinmemory.c source ] You are in full control of the callback function that gets called every time there is data received from the remote server. You can make that callback do whatever you want. You do not have to write the received data to a file. One solution to this problem could be to have a pointer to a struct that you pass to the callback function. You set the pointer using the CURLOPT_WRITEDATA option. Then that pointer will be passed to the callback instead of a FILE * to a file: /* imaginary struct */ struct MemoryStruct { char *memory; size_t size; }; /* imaginary callback function */ size_t WriteMemoryCallback(void *ptr, size_t size, size_t nmemb, void *data) { size_t realsize = size * nmemb; struct MemoryStruct *mem = (struct MemoryStruct *)data; mem->memory = (char *)realloc(mem->memory, mem->size + realsize + 1); if (mem->memory) { memcpy(&(mem->memory[mem->size]), ptr, realsize); mem->size += realsize; mem->memory[mem->size] = 0; } return realsize; } 5.3 How do I fetch multiple files with libcurl? libcurl has excellent support for transferring multiple files. You should just repeatedly set new URLs with curl_easy_setopt() and then transfer it with curl_easy_perform(). The handle you get from curl_easy_init() is not only reusable, but you are even encouraged to reuse it if you can, as that will enable libcurl to use persistent connections. 5.4 Does libcurl do Winsock initialization on win32 systems? Yes, if told to in the curl_global_init() call. 5.5 Does CURLOPT_WRITEDATA and CURLOPT_READDATA work on win32 ? Yes, but you cannot open a FILE * and pass the pointer to a DLL and have that DLL use the FILE * (as the DLL and the client application cannot access each others' variable memory areas). If you set CURLOPT_WRITEDATA you must also use CURLOPT_WRITEFUNCTION as well to set a function that writes the file, even if that simply writes the data to the specified FILE *. Similarly, if you use CURLOPT_READDATA you must also specify CURLOPT_READFUNCTION. 5.6 What about Keep-Alive or persistent connections? curl and libcurl have excellent support for persistent connections when transferring several files from the same server. curl will attempt to reuse connections for all URLs specified on the same command line/config file, and libcurl will reuse connections for all transfers that are made using the same libcurl handle. When you use the easy interface the connection cache is kept within the easy handle. If you instead use the multi interface, the connection cache will be kept within the multi handle and will be shared among all the easy handles that are used within the same multi handle. 5.7 Link errors when building libcurl on Windows You need to make sure that your project, and all the libraries (both static and dynamic) that it links against, are compiled/linked against the same run time library. This is determined by the /MD, /ML, /MT (and their corresponding /M?d) options to the command line compiler. /MD (linking against MSVCRT dll) seems to be the most commonly used option. When building an application that uses the static libcurl library, you must add -DCURL_STATICLIB to your CFLAGS. Otherwise the linker will look for dynamic import symbols. If you are using Visual Studio, you need to instead add CURL_STATICLIB in the "Preprocessor Definitions" section. If you get a linker error like "unknown symbol __imp__curl_easy_init ..." you have linked against the wrong (static) library. If you want to use the libcurl.dll and import lib, you do not need any extra CFLAGS, but use one of the import libraries below. These are the libraries produced by the various lib/Makefile.* files: Target: static lib. import lib for libcurl*.dll. ----------------------------------------------------------- MinGW: libcurl.a libcurldll.a MSVC (release): libcurl.lib libcurl_imp.lib MSVC (debug): libcurld.lib libcurld_imp.lib Borland: libcurl.lib libcurl_imp.lib 5.8 libcurl.so.X: open failed: No such file or directory This is an error message you might get when you try to run a program linked with a shared version of libcurl and your runtime linker (ld.so) could not find the shared library named libcurl.so.X. (Where X is the number of the current libcurl ABI, typically 3 or 4). You need to make sure that ld.so finds libcurl.so.X. You can do that multiple ways, and it differs somewhat between different operating systems. They are usually: * Add an option to the linker command line that specify the hard-coded path the runtime linker should check for the lib (usually -R) * Set an environment variable (LD_LIBRARY_PATH for example) where ld.so should check for libs * Adjust the system's config to check for libs in the directory where you have put the library (like Linux's /etc/ld.so.conf) 'man ld.so' and 'man ld' will tell you more details 5.9 How does libcurl resolve host names? libcurl supports a large number of name resolve functions. One of them is picked at build-time and will be used unconditionally. Thus, if you want to change name resolver function you must rebuild libcurl and tell it to use a different function. - The non-IPv6 resolver that can use one of four different host name resolve calls (depending on what your system supports): A - gethostbyname() B - gethostbyname_r() with 3 arguments C - gethostbyname_r() with 5 arguments D - gethostbyname_r() with 6 arguments - The IPv6-resolver that uses getaddrinfo() - The c-ares based name resolver that uses the c-ares library for resolves. Using this offers asynchronous name resolves. - The threaded resolver (default option on Windows). It uses: A - gethostbyname() on plain IPv4 hosts B - getaddrinfo() on IPv6 enabled hosts Also note that libcurl never resolves or reverse-lookups addresses given as pure numbers, such as 127.0.0.1 or ::1. 5.10 How do I prevent libcurl from writing the response to stdout? libcurl provides a default built-in write function that writes received data to stdout. Set the CURLOPT_WRITEFUNCTION to receive the data, or possibly set CURLOPT_WRITEDATA to a different FILE * handle. 5.11 How do I make libcurl not receive the whole HTTP response? You make the write callback (or progress callback) return an error and libcurl will then abort the transfer. 5.12 Can I make libcurl fake or hide my real IP address? No. libcurl operates on a higher level. Besides, faking IP address would imply sending IP packets with a made-up source address, and then you normally get a problem with receiving the packet sent back as they would then not be routed to you. If you use a proxy to access remote sites, the sites will not see your local IP address but instead the address of the proxy. Also note that on many networks NATs or other IP-munging techniques are used that makes you see and use a different IP address locally than what the remote server will see you coming from. You may also consider using https://www.torproject.org/ . 5.13 How do I stop an ongoing transfer? With the easy interface you make sure to return the correct error code from one of the callbacks, but none of them are instant. There is no function you can call from another thread or similar that will stop it immediately. Instead, you need to make sure that one of the callbacks you use returns an appropriate value that will stop the transfer. Suitable callbacks that you can do this with include the progress callback, the read callback and the write callback. If you are using the multi interface, you can also stop a transfer by removing the particular easy handle from the multi stack at any moment you think the transfer is done or when you wish to abort the transfer. 5.14 Using C++ non-static functions for callbacks? libcurl is a C library, it does not know anything about C++ member functions. You can overcome this "limitation" with relative ease using a static member function that is passed a pointer to the class: // f is the pointer to your object. static size_t YourClass::func(void *buffer, size_t sz, size_t n, void *f) { // Call non-static member function. static_cast(f)->nonStaticFunction(); } // This is how you pass pointer to the static function: curl_easy_setopt(hcurl, CURLOPT_WRITEFUNCTION, YourClass::func); curl_easy_setopt(hcurl, CURLOPT_WRITEDATA, this); 5.15 How do I get an FTP directory listing? If you end the FTP URL you request with a slash, libcurl will provide you with a directory listing of that given directory. You can also set CURLOPT_CUSTOMREQUEST to alter what exact listing command libcurl would use to list the files. The follow-up question tends to be how is a program supposed to parse the directory listing. How does it know what's a file and what's a directory and what's a symlink etc. If the FTP server supports the MLSD command then it will return data in a machine-readable format that can be parsed for type. The types are specified by RFC 3659 section 7.5.1. If MLSD is not supported then you have to work with what you are given. The LIST output format is entirely at the server's own liking and the NLST output does not reveal any types and in many cases does not even include all the directory entries. Also, both LIST and NLST tend to hide unix-style hidden files (those that start with a dot) by default so you need to do "LIST -a" or similar to see them. Example - List only directories. ftp.funet.fi supports MLSD and ftp.kernel.org does not: curl -s ftp.funet.fi/pub/ -X MLSD | \ perl -lne 'print if s/(?:^|;)type=dir;[^ ]+ (.+)$/$1/' curl -s ftp.kernel.org/pub/linux/kernel/ | \ perl -lne 'print if s/^d[-rwx]{9}(?: +[^ ]+){7} (.+)$/$1/' If you need to parse LIST output in libcurl one such existing list parser is available at https://cr.yp.to/ftpparse.html Versions of libcurl since 7.21.0 also provide the ability to specify a wildcard to download multiple files from one FTP directory. 5.16 I want a different time-out Sometimes users realize that CURLOPT_TIMEOUT and CURLOPT_CONNECTIMEOUT are not sufficiently advanced or flexible to cover all the various use cases and scenarios applications end up with. libcurl offers many more ways to time-out operations. A common alternative is to use the CURLOPT_LOW_SPEED_LIMIT and CURLOPT_LOW_SPEED_TIME options to specify the lowest possible speed to accept before to consider the transfer timed out. The most flexible way is by writing your own time-out logic and using CURLOPT_XFERINFOFUNCTION (perhaps in combination with other callbacks) and use that to figure out exactly when the right condition is met when the transfer should get stopped. 5.17 Can I write a server with libcurl? No. libcurl offers no functions or building blocks to build any kind of Internet protocol server. libcurl is only a client-side library. For server libraries, you need to continue your search elsewhere but there exist many good open source ones out there for most protocols you could want a server for. There are also really good stand-alone servers that have been tested and proven for many years. There is no need for you to reinvent them. 5.18 Does libcurl use threads? Put simply: no, libcurl will execute in the same thread you call it in. All callbacks will be called in the same thread as the one you call libcurl in. If you want to avoid your thread to be blocked by the libcurl call, you make sure you use the non-blocking multi API which will do transfers asynchronously - still in the same single thread. libcurl will potentially internally use threads for name resolving, if it was built to work like that, but in those cases it will create the child threads by itself and they will only be used and then killed internally by libcurl and never exposed to the outside. 6. License Issues curl and libcurl are released under a MIT/X derivative license. The license is liberal and should not impose a problem for your project. This section is just a brief summary for the cases we get the most questions. (Parts of this section was much enhanced by Bjorn Reese.) We are not lawyers and this is not legal advice. You should probably consult one if you want true and accurate legal insights without our prejudice. Note especially that this section concerns the libcurl license only; compiling in features of libcurl that depend on other libraries (e.g. OpenSSL) may affect the licensing obligations of your application. 6.1 I have a GPL program, can I use the libcurl library? Yes Since libcurl may be distributed under the MIT/X derivative license, it can be used together with GPL in any software. 6.2 I have a closed-source program, can I use the libcurl library? Yes libcurl does not put any restrictions on the program that uses the library. 6.3 I have a BSD licensed program, can I use the libcurl library? Yes libcurl does not put any restrictions on the program that uses the library. 6.4 I have a program that uses LGPL libraries, can I use libcurl? Yes The LGPL license does not clash with other licenses. 6.5 Can I modify curl/libcurl for my program and keep the changes secret? Yes The MIT/X derivative license practically allows you to do almost anything with the sources, on the condition that the copyright texts in the sources are left intact. 6.6 Can you please change the curl/libcurl license to XXXX? No. We have carefully picked this license after years of development and discussions and a large amount of people have contributed with source code knowing that this is the license we use. This license puts the restrictions we want on curl/libcurl and it does not spread to other programs or libraries that use it. It should be possible for everyone to use libcurl or curl in their projects, no matter what license they already have in use. 6.7 What are my obligations when using libcurl in my commercial apps? Next to none. All you need to adhere to is the MIT-style license (stated in the COPYING file) which basically says you have to include the copyright notice in "all copies" and that you may not use the copyright holder's name when promoting your software. You do not have to release any of your source code. You do not have to reveal or make public any changes to the libcurl source code. You do not have to broadcast to the world that you are using libcurl within your app. All we ask is that you disclose "the copyright notice and this permission notice" somewhere. Most probably like in the documentation or in the section where other third party dependencies already are mentioned and acknowledged. As can be seen here: https://curl.se/docs/companies.html and elsewhere, more and more companies are discovering the power of libcurl and take advantage of it even in commercial environments. 7. PHP/CURL Issues 7.1 What is PHP/CURL? The module for PHP that makes it possible for PHP programs to access curl- functions from within PHP. In the cURL project we call this module PHP/CURL to differentiate it from curl the command line tool and libcurl the library. The PHP team however does not refer to it like this (for unknown reasons). They call it plain CURL (often using all caps) or sometimes ext/curl, but both cause much confusion to users which in turn gives us a higher question load. 7.2 Who wrote PHP/CURL? PHP/CURL was initially written by Sterling Hughes. 7.3 Can I perform multiple requests using the same handle? Yes - at least in PHP version 4.3.8 and later (this has been known to not work in earlier versions, but the exact version when it started to work is unknown to me). After a transfer, you just set new options in the handle and make another transfer. This will make libcurl reuse the same connection if it can. 7.4 Does PHP/CURL have dependencies? PHP/CURL is a module that comes with the regular PHP package. It depends on and uses libcurl, so you need to have libcurl installed properly before PHP/CURL can be used. 8. Development 8.1 Why does curl use C89? As with everything in curl, there is a history and we keep using what we have used before until someone brings up the subject and argues for and works on changing it. We started out using C89 in the 1990s because that was the only way to write a truly portable C program and have it run as widely as possible. C89 was for a long time even necessary to make things work on otherwise considered modern platforms such as Windows. Today, we do not really know how many users that still require the use of a C89 compiler. We will continue to use C89 for as long as nobody brings up a strong enough reason for us to change our minds. The core developers of the project do not feel restricted by this and we are not convinced that going C99 will offer us enough of a benefit to warrant the risk of cutting off a share of users. 8.2 Will curl be rewritten? In one go: no. Little by little over time? Maybe. Over the years, new languages and clever operating environments come and go. Every now and then the urge apparently arises to request that we rewrite curl in another language. Some the most important properties in curl are maintaining the API and ABI for libcurl and keeping the behavior for the command line tool. As long as we can do that, everything else is up for discussion. To maintain the ABI, we probably have to maintain a certain amount of code in C, and to remain rock stable, we will never risk anything by rewriting a lot of things in one go. That said, we can certainly offer more and more optional backends written in other languages, as long as those backends can be plugged in at build-time. Backends can be written in any language, but should probably provide APIs usable from C to ease integration and transition. PK>> referenced by wolfssl.c:235 (vtls/wolfssl.c:235) >>> libcurl_la-wolfssl.o:(wolfssl_bio_cf_create) in archiv e ../lib/.libs/libcurl.a cc: error: linker command failed with exit code 1 (use -v to see invocat ion) *** Error code 1 Closes #13164 Daniel Stenberg (25 Mar 2024) - cmdline-opts: shorter help texts In an effort to increase the readability of the "--help all" output on narrow (80 column) terminals. Co-authored-by: Jay Satiro Closes #13169 Matt Jolly (25 Mar 2024) - curl-rustls.m4: add pkg-config support to rustls detection Based on the existing openssl pkg-config detection, this commit tries to use pkg-config to find `rustls` then falls back to the current approach if that fails. We use the following logic: - if no path is provided, just use pkg-config, if it's not there we have a problem! - if a path is provided, try pkg-config + if pkg-config fails, try and find rustls directly Closes #13179 Mohammadreza Hendiani (25 Mar 2024) - TODO: update 13.11 with more information Closes #13173 Daniel Stenberg (23 Mar 2024) - docs/libcurl: generate PROTOCOLS from meta-data Remove the PROTOCOLS section from the source files completely and instead generate them based on the header data in the curldown files. It also generates TLS backend information for options marked for TLS as protocol. Closes #13175 - CURLMOPT_MAX*: mention what happens if changed mid-transfer For CURLMOPT_MAXCONNECTS and CURLMOPT_MAX_HOST_CONNECTIONS Ref: #13158 Closes #13176 - docs/libcurl: add TLS backend info for all TLS options All man pages that are listed to be for TLS now must also specify exactly what TLS backends the option works for, or use All if they all work. cd2nroff makes sure this is done and that the listed backends exist. Closes #13168 - docs/libcurl: cleanups - CURLINFO_TLS_SESSION.md: remove mention of NSS - CURLINFO_TLS_SSL_PTR.md: remove NSS leftover - CURLOPT_CAINFO.md: drop mention of backends not supporting this - CURLOPT_CAPATH.md: wolfSSL also supports this Closes #13166 - docs: make each libcurl man specify protocol(s) The mandatory header now has a mandatory list of protocols for which the manpage is relevant. Most man pages already has a "PROTOCOLS" section, but this introduces a stricter way to specify the relevant protocols. cd2nroff verifies that at least one protocol is mentioned (which can be `*`). This information is not used just yet, but A) the PROTOCOLS section can now instead get generated and get a unified wording across all manpages and B) this allows us to more reliably filter/search for protocol specific manpages/options. Closes #13166 Stefan Eissing (21 Mar 2024) - http2, http3: only return CURLE_PARTIAL_FILE when bytes were received - should resolve spurious pytest failures when stream were reset right after response header were received Clsoes #13151 - http: separate response parsing from response action - move code that triggers on end-of-response into separate function from parsing - simplify some headp/headerlen usage - add `httpversion` to SingleRequest to indicate the version of the current response Closes #13134 Daniel Stenberg (21 Mar 2024) - http2: remove the third (unused) argument from http2_data_done() Closes #13154 - RELEASE-NOTES: synced Evgeny Grin (Karlson2k) (21 Mar 2024) - RELEASE-NOTES: corrected Corrected link for item 118 Closes #13157 Daniel Stenberg (19 Mar 2024) - CURLOPT_INTERFACE.md: remove spurious amp, add see-also Closes #13149 Stefan Eissing (19 Mar 2024) - http: improve response header handling, save cpu cycles Saving some cpu cycles in http response header processing: - pass the length of the header line along - use string constant sizeof() instead of strlen() - check line length if prefix is possible - switch on first header char to limit checks Closes #13143 Daniel Stenberg (19 Mar 2024) - tool_getparam: accept a blank -w "" Added test 468 to verify. Regression from 07bcae89d5d00 (shipped in 8.6.0) Reported-by: Thomas Pyle Fixes #13144 Closes #13145 Evgeny Grin (Karlson2k) (18 Mar 2024) - curl_sha512_256: work around a NetBSD bug Based on Michael Kaufmann analysis and suggestion Closes #13133 Stefan Eissing (18 Mar 2024) - http: expect 100 rework Move all handling of HTTP's `Expect: 100-continue` feature into a client reader. Add sending flag `KEEP_SEND_TIMED` that triggers transfer sending on general events like a timer. HTTP installs a `CURL_CR_PROTOCOL` reader when announcing `Expect: 100-continue`. That reader works as follows: - on first invocation, records time, starts the `EXPIRE_100_TIMEOUT` timer, disables `KEEP_SEND`, enables `KEEP_SEND_TIMER` and returns 0, eos=FALSE like a paused upload. - on subsequent invocation it checks if the timer has expired. If so, it enables `KEEP_SEND` and switches to passing through reads to the underlying readers. Transfer handling's `readwrite()` will be invoked when a timer expires (like `EXPIRE_100_TIMEOUT`) or when data from the server arrives. Seeing `KEEP_SEND_TIMER`, it will try to upload more data, which triggers reading from the client readers again. Which then may lead to a new pausing or cause the upload to start. Flags and timestamps connected to this have been moved from `SingleRequest` into the reader's context. Closes #13110 - mbedtls: fix pytest for newer versions Fix the expectations in pytest for newer versions of mbedtls Closes #13132 Daniel Stenberg (15 Mar 2024) - ipv6.md: mention IPv4 mapped addresses Reported-by: Josh Soref Assisted-by: Jay Satiro Fixes #13112 Closes #13131 Stefan Eissing (15 Mar 2024) - http: revisit http_perhapsrewind() - use facilities provided by client readers better - work also for non-uploading requests like GET/HEAD - update documentation Closes #13117 - test 1541: verify getinfo values on first header callback Reported-by: chensong1211 on github Ref: #13125 Closes #13128 - TLS: start shutdown only when peer did not already close - When curl sees a TCP close from the peer, do not start a TLS shutdown. TLS shutdown is a handshake and if the peer already closed the connection, it is not interested in participating. Reported-by: dfdity on github Assisted-by: Jiří Bok Assisted-by: Pēteris Caune Fixes #10290 Closes #13087 Daniel Stenberg (14 Mar 2024) - RELEASE-NOTES: synced - curl: make --libcurl output better CURLOPT_*SSLVERSION The option is really two enums ORed together, so it needs special attention to make the code output nice. Added test 1481 to verify. Both the server and the proxy versions. Reported-by: Boris Verkhovskiy Fixes #13127 Closes #13129 - GHA/linux: add sysctl trick to work-around GitHub runner issue The GitHub image runner update from 20240304.1.0 to 20240310.1 introduces a problem for clang-14. The issue is caused by incompatibility between llvm 14 provided in ubuntu-22.04 image and the much newer kernel configured with high-entropy ASLR. As a work-around, we issue a sysctl command to lower the entropy and get clang-14 to work again. URL: https://github.com/actions/runner-images/issues/9491 Closes #13124 - SPONSORS: describe the basics Closes #13119 - GOVERNANCE: document the core team Closes #13118 Jay Satiro (13 Mar 2024) - vquic-tls: fix the error code returned for bad CA file - Return CURLE_SSL_CACERT_BADFILE if wolfSSL encounters a problem reading the cert file or path. This is a follow-up to the parent commit aedbbdf1. Reported-by: Karthikdasari0423@users.noreply.github.com Fixes https://github.com/curl/curl/issues/13115 Daniel Stenberg (12 Mar 2024) - vquic-tls: return appropirate errors on wolfSSL errors Reported-by: Dexter Gerig Closes #13107 Viktor Szakats (12 Mar 2024) - tidy-up: one comment and EOF newlines Reviewed-by: Daniel Stenberg Closes #13108 Daniel Stenberg (12 Mar 2024) - cmdline-opts: language cleanups Use imperative mood consistently for the first sentence describing an option. "Set this" instead "tell curl to set" or "this sets..." Plus some extra cleanups and rephrasing. Closes #13106 - managen: remove space before protocols For options that are listed for specific protocols, the protocols (shown first within parentheses) are now output without the leading space in the manpage output. Closes #13105 Jay Satiro (12 Mar 2024) - mbedtls: properly cleanup the thread-shared entropy - Store the state of the thread-shared entropy for global init/cleanup. - Use curl's thread support of mbedtls for all Windows builds instead of just when the threaded resolver is used via USE_THREADS_WIN32. Prior to this change on global cleanup curl builds that have curl thread support for mbedtls freed the entropy (8b1d2298) but failed to mark that it had been freed, which caused problems on subsequent init + transfer. Bug: https://github.com/curl/curl/discussions/11919#discussioncomment-8687105 Reported-by: awesomekosm@users.noreply.github.com Closes https://github.com/curl/curl/pull/13071 Daniel Stenberg (12 Mar 2024) - tool_getparam: handle non-existing (out of range) short-options ... correctly, even when they follow an existing one without a space in between. Verify with test 467 Follow-up to 07dd60c05b Reported-by: Geeknik Labs Fixes #13101 Closes #13102 Stefan Eissing (11 Mar 2024) - lib: move 'done' parameter to SingleRequests A transfer may do several `SingleRequest`s for its success. This happens regularly for authentication, follows and retries on failed connections. The "readwrite()" calls and functions connected to those carried a `bool *done` parameter to indicate that the current `SingleRequest` is over. This may happen before `upload_done` or `download_done` bits of `SingleRequest` are set. The problem with that is now `write_resp()` protocol handlers are invoked in places where the `bool *done` cannot be passed up to the caller. Instead of being a bool in the call chain, it needs to become a member of `SingleRequest`, reflecting its state. This removes the `bool *done` parameter and adds the `done` bit to `SingleRequest` instead. It adds `Curl_req_soft_reset()` for using a `SingleRequest` in a follow up, clearing `done` and other flags/counters. Closes #13096 - request: clarify message when request has been sent off Change the "uploaded and fine" message for requests without a body Reported-by: Karthikdasari0423 on github Fixes #13093 Closes #13095 Daniel Stenberg (11 Mar 2024) - RELEASE-NOTES: synced Stefan Eissing (9 Mar 2024) - lib: keep conn IP information together new struct ip_quadruple for holding local/remote addr+port - used in data->info and conn and cf-socket.c - copy back and forth complete struct - add 'secondary' to conn - use secondary in reporting success for ftp 2nd connection Reported-by: DasKutti on github Fixes #13084 Closes #13090 Daniel Stenberg (8 Mar 2024) - scripts/managen: the new name and home for the manpage generator It was previously docs/cmdline-opts/gen.pl Closes #13089 - VULN-DISCLOSURE-POLICY.md: update detail about CVE requests curl is a CNA now Closes #13088 Stefan Eissing (8 Mar 2024) - lib: client reader polish - seek_func/seek_client, use transfer values only - remove copies held in `struct connectdata`, use only ever `data->set.seek_func` - resolves possible issues in multiuse connections - new mime post reader eliminates need to ever overwriting this - websockets, remove empty Curl_ws_done() function Closes #13079 Marcel Raad (8 Mar 2024) - lib1598: fix `CURLOPT_POSTFIELDSIZE` usage It requires a `long` argument. Closes https://github.com/curl/curl/pull/13085 Daniel Stenberg (8 Mar 2024) - docs/cmdline-opts: drop the curl.1 from the dist tarball Since it is no longer needed for building tool_hugehelp.c and all the docs is available in readable markdown format in the tarball, the peeps that don't want to build the manpage still do good. Removing it also fixes the complexity of out-of-tree builds when the curl.1 exists in the source tree. - test1140/1173: extend wildcards to find curl.1 ... in its new build path. Also update the test scripts to be more precise in error messages to help us understand CI errors better. Follow-up to f03c85635f35269f1 Ref: #13029 Closes #13083 - http2: minor tweaks to optimize two struct sizes - use BIT() instead of bool - place the struct fields in (roughly) size order Closes #13082 - buildconf.bat: remove outdated groff/nroff use - don't try to generate the real hugehelp file, because it requires curl.txt which needs a build - don't attempt to do anything in a c-ares subdirectory Follow-up to f03c85635f35269 Closes #13078 - http2: memory errors in the push callbacks are fatal Use the correct nghttp2 error code accordingly. Closes #13081 Viktor Szakats (7 Mar 2024) - mkhelp: rename variable to fix compiler warnings ``` src\tool_operate.c(541,33): warning C4459: declaration of 'm' hides global de claration [_bld\src\curl.vcxproj] _bld\src\tool_hugehelp.c(8,27): see declaration of 'm' src\tool_paramhlp.c(307,14): warning C4459: declaration of 'm' hides global d eclaration [_bld\src\curl.vcxproj] src\tool_progress.c(118,16): warning C4459: declaration of 'm' hides global d eclaration [_bld\src\curl.vcxproj] src\tool_writeout.c(288,31): warning C4459: declaration of 'm' hides global d eclaration [_bld\src\curl.vcxproj] ``` Ref: https://ci.appveyor.com/project/curlorg/curl/builds/49348159/job/51ee75c d2n0wj6lc#L614 Reviewed-by: Daniel Stenberg Closes #13077 Daniel Stenberg (7 Mar 2024) - KNOWN_BUGS: POP3 issue when reading small chunks Closes #12063 - RELEASE-NOTES: synced Robert Moreton (7 Mar 2024) - asyn-ares: fix data race warning - Store the c-ares version during global init. Prior to this change several threads could write the same data to a static int variable at the same time. Though in practice it's not a problem ThreadSanitizer may warn. Reported-by: Nikita Taranov Assisted-by: Jay Satiro Fixes #13065 Closes #13000 Stefan Eissing (7 Mar 2024) - hyper: implement unpausing via client reader Just a tidy up to contain 'ifdef' pollution of common code parts with implementation specifics. - remove the ifdef hyper unpausing in easy.c - add hyper client reader for CURL_CR_PROTOCOL phase that implements the unpause method for calling the hyper waker if it is set Closes #13075 - ngtcp2: no recvbuf for stream - write response data directly to the transfer via `Curl_xfer_write_resp()` like we do in HTTP/2. Closes #13073 - docs/cmdline-opts/.gitignore: ignore curl.txt Closes #13076 Evgeny Grin (Karlson2k) (7 Mar 2024) - sha512_256: add support for GnuTLS and OpenSSL This is a follow-up for PR #12897. Add support for SHA-512/256 digest calculation by TLS backends. Currently only OpenSSL and GnuTLS (actually, nettle) support SHA-512/256. Closes #13070 - digest: add check for hashing error Closes #13072 Viktor Szakats (7 Mar 2024) - cmake: enable `ENABLE_CURL_MANUAL` by default Meaning `curl.1` and `src/tool_hugehelp.c` are built by default, and `--manual` in curl tool is also enabled by default. This syncs behaviour with autotools. For a reproducible `curl.1`, `SOURCE_DATE_EPOCH` needs to be set to a consistent date, e.g. the timestamp of `CHANGES`. A pre-built manual (e.g. the one distributed in the official source tarball) will be ignored and rebuilt after this patch, unless explicitly disabling this option. Fixes #13028 Closes #13069 Stefan Eissing (7 Mar 2024) - http2: push headers better cleanup - provide common cleanup method for push headers Closes #13054 Daniel Stenberg (7 Mar 2024) - GIT-INFO: convert to markdown Closes #13074 Richard Levitte (7 Mar 2024) - cmake: fix libcurl.pc and curl-config library specifications Letting CMake figure out where libraries are located gives you full paths. When generating libcurl.pc and curl-config, getting libraries as full paths is unusual when one expects to get a list of -l. To meet expectations, an effort is made to convert the full paths into -l, possibly with -L before it. Fixes #6169 Fixes #12748 Closes #12930 Daniel Stenberg (7 Mar 2024) - test463: HTTP with -d @file with file containing CR, LF and null byte - paramhlp: fix CRLF-stripping files with "-d @file" All CR and LF bytes should be stripped, as documented, and all other bytes are inluded in the data. Starting now, it also excludes null bytes as they would otherwise also cut the data short. Reported-by: Simon K Fixes #13063 Closes #13064 Viktor Szakats (7 Mar 2024) - cmake: fix `CURL_WINDOWS_SSPI=ON` with Schannel disabled Prior to this change `CURL_WINDOWS_SSPI` was accidentally forced `OFF` when building without the Schannel TLS backend. This in turn may have caused Kerberos, SPNEGO and SSPI features disappearing even with `CURL_WINDOWS_SSPI=ON` set. This patch fixes it by using the `CURL_USE_SCHANNEL` setting as a default for `CURL_WINDOWS_SSPI`, but allowing a manual override. Also update the option text to better tell its purpose. Thanks-to: Andreas Loew Reviewed-by: Daniel Stenberg Ref: #13056 Closes #13061 Jay Satiro (6 Mar 2024) - KNOWN_BUGS: FTPS server compatibility on Windows with Schannel - Remove "2.12 FTPS with Schannel times out file list operation" - Remove "7.12 FTPS directory listing hangs on Windows with Schannel" - Add "7.12 FTPS server compatibility on Windows with Schannel" This change adds a more generic bug description that explains FTPS with the latest curl and Schannel is not widely used and may have more bugs than other TLS backends. The two removed FTPS Schannel bugs can't be reproduced any longer and were likely fixed by 24d6c288. Ref: https://github.com/curl/curl/issues/5284 Ref: https://github.com/curl/curl/issues/9161 Ref: https://github.com/curl/curl/issues/12894 Closes https://github.com/curl/curl/pull/13032 - trace-config.md: remove the mutexed options list - Remove the rendered manpage message that says: "[--trace-config] is mutually exclusive to --trace and -v, --verbose". Actually it can be used with either of those options, which are mutually exclusive to each other but not to --trace-config. Ref: https://curl.se/docs/manpage.html#--trace-config Closes https://github.com/curl/curl/pull/13031 Daniel Stenberg (6 Mar 2024) - mkhelp: simplify the generated hugehelp program Use a plain array and puts() every line, also allows us to provide the strings without ending newlines. - merge blank lines into the next one as a prefixed newline. - turn eight consecutive spaces into a tab (since they can only be on the left side of text) - the newly generated tool_hugehelp is 3K lines shorter and 50K smaller - modifies the top logo layout a little by reducing the indent Closes #13047 - docs: ascii version of manpage without nroff Create ASCII version of manpage without nroff - build src/tool_hugegelp.c from the ascii manpage - move the the manpage and the ascii version build to docs/cmdline-opts - remove all use of nroff from the build process - should make the build entirely reproducible (by avoiding nroff) - partly reverts 2620aa9 to build libcurl option man pages one by one in cmake because the appveyor builds got all crazy until I did The ASCII version of the manpage - is built with gen.pl, just like the manpage is - has a right-justified column making the appearance similar to the previous version - uses a 4-space indent per level (instead of the old version's 7) - does not do hyphenation of words (which nroff does) History We first made the curl build use nroff for building the hugehelp file in December 1998, for curl 5.2. Closes #13047 Stefan Eissing (6 Mar 2024) - lib: add `void *ctx` to reader/writer instances - `struct Curl_cwriter` and `struct Curl_creader` now carry a `void *ctx` member that points to the instance as allocated. - using `r->ctx` and `w->ctx` as pointer to the instance specific struct that has been allocated Reported-by: Rudi Heitbaum Fixes #13035 Closes #13059 - http: fix dead code in setting post client reader - postsize was always 0, thus the check's else never happened after the mime client reader was introduced Follow-up to 0ba47146f7ff3d Closes #13060 - http2: fix push discard - fix logic in discarding a failed pushed stream so that stream context is properly cleaned up Closes #13055 - transfer.c: break receive loop in speed limited transfers - the change breaks looping in transfer.c receive for transfers that are speed limited on having gotten *some* bytes. - the overall speed limit timing is done in multi.c Reported-by: Dmitry Karpov Bug: https://curl.se/mail/lib-2024-03/0001.html Closes #13050 - mime: add client reader Add `mime` client reader. Encapsulates reading from mime parts, getting their length, rewinding and unpausing. - remove special mime handling from sendf.c and easy.c - add general "unpause" method to client readers - use new reader in http/imap/smtp - make some mime functions static that are now only used internally In addition: - remove flag 'forbidchunk' as no longer needed Closes #13039 Daniel Stenberg (5 Mar 2024) - RELEASE-NOTES: synced - TODO: remove "build HTTP/3 with OpenSSL and nghttp3 using cmake" Follow-up to 8e741644a229c37 Tal Regev (5 Mar 2024) - cmake: add USE_OPENSSL_QUIC support Closes #13034 Stefan Eissing (5 Mar 2024) - TIMER_STARTTRANSFER: set the same for everyone - set TIMER_STARTTRANSFER on seeing the first response bytes in the download client writer, not coming from a CONNECT - initialized the timer the same way for all protocols - remove explicit setting of TIMER_STARTTRANSFER in file.c and c-hyper.c Closes #13052 Michael Kaufmann (5 Mar 2024) - http: better error message for HTTP/1.x response without status line If a response without a status line is received, and the connection is known to use HTTP/1.x (not HTTP/0.9), report the error "Invalid status line" instead of "Received HTTP/0.9 when not allowed". Closes #13045 Viktor Szakats (5 Mar 2024) - KNOWN_BUGS: fix typo Reviewed-by: Daniel Stenberg Closes #13051 Sebastian Neubauer (5 Mar 2024) - smpt: fix starttls In cases where the connection was fast, curl sometimes failed to open a connection. This fixes a regression of c2d973627bab12abc5486a3f3. The regression triggered in these steps: 1. Create an smtp connection 2. Use STARTTLS 3. Receive the response 4. We are inside the loop in `smtp_statemachine`, calling `smtp_state_starttls_resp` 5. In the good flow, we exit the loop, re-enter `smtp_statemachine` and run `smtp_perform_upgrade_tls` at the start of the function. In the bad flow, we stay in the while loop, calling `Curl_pp_readresp`, which reads part of the TLS handshake and things go wrong. The reason is that `Curl_pp_moredata` changed behavior and always returns `true`, so we stay in the loop in `smtp_statemachine`. With a slow connection `Curl_pp_readresp` cannot read new data and returns `CURL_AGAIN`, so we leave the loop and re-enter `smtp_statemachine`. With a fast connection, `Curl_pp_readresp` reads new data from the tcp connection, which is part of the TLS handshake. The fix is in `Curl_pp_moredata`, which needs to take the final line into account and return `false` if only the final line is stored. Closes #13048 Stefan Eissing (5 Mar 2024) - lib: enhance client reader resume + rewind - update client reader documentation - client reader, add rewind capabilities - tell creader to rewind on next start - Curl_client_reset() will keep reader for future rewind if requested - add Curl_client_cleanup() for freeing all resources independent of rewinds - add Curl_client_start() to trigger rewinds - move rewind code from multi.c to sendf.c and make part of "cr-in"'s implementation - http, move the "resume_from" handling into the client readers - the setup of a HTTP request is reshuffled to follow: * determine method, target, auth negotiation * install the client reader(s) for the request, including crlf conversions and "chunked" encoding * apply ranges to client reader * concat request headers, upgrades, cookies, etc. * complete request by determining Content-Length of installed readers in combination with method * send - add methods for client readers to * return the overall length they will generate (or -1 when unknown) * return the amount of data on the CLIENT level, so that expect-100 can decide if it want to apply itself * set a "resume_from" offset or fail if unsupported - struct HTTP has become largely empty now - rename `Client_reader_*` to `Curl_creader_*` Closes #13026 Viktor Szakats (5 Mar 2024) - openssl-quic: fix BIO leak and Windows warning Caused by an accidentally duplicated line in d6825df334def106f735ce7e0c1a2ea87bddffb0. ``` .../lib/vquic/curl_osslq.c:1095:30: warning: implicit conversion loses intege r precision: 'curl_socket_t' (aka 'unsigned long long') to 'int' [-Wshorten-6 4-to-32] 1095 | bio = BIO_new_dgram(ctx->q.sockfd, BIO_NOCLOSE); | ~~~~~~~~~~~~~ ~~~~~~~^~~~~~ 1 warning and 2 errors generated. ``` Reviewed-by: Stefan Eissing Closes #13043 - openssl-quic: fix unity build, casing, indentation - rename static functions to avoid duplicate symbols in unity mode. - windows -> Windows/window in error message and comment. - fix indentation. Reviewed-by: Stefan Eissing Closes #13044 Daniel Stenberg (5 Mar 2024) - gen.pl: make the "manpageification" faster The function that replaces occurances of "--longoption" with "-Z, --longoption" etc with the proper highlight applied, no longer loops over the options. Closes #13041 - CONTRIBUTE: update the section on documentation format ... since most of it is markdown now. Closes #13046 - smtp: free a temp resource The returned address needs to be freed. Follow-up to e3905de8196d67b89df1602feb84c1f993211b20 Spotted by Coverity Closes #13038 - _VARIABLES.md: improve the description Closes #13040 dependabot[bot] (4 Mar 2024) - build(deps): bump fsfe/reuse-action from 2 to 3 Bumps [fsfe/reuse-action](https://github.com/fsfe/reuse-action) from 2 to 3. - [Release notes](https://github.com/fsfe/reuse-action/releases) - [Commits](https://github.com/fsfe/reuse-action/compare/v2...v3) --- updated-dependencies: - dependency-name: fsfe/reuse-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Stefan Eissing (4 Mar 2024) - pytest: adapt to API change - pytest has changed the signature of the hook pytest_report_header() for some obscure reason and that change landed in our CI now - remove the changed param that we never used anyway Closes #13037 Daniel Stenberg (4 Mar 2024) - cookie: if psl fails, reject the cookie A libpsl install without data and no built-in database is now considered bad enough to reject all cookies since they cannot be checked. It is somewhat of a user error, but still. Reported-by: Dan Fandrich Closes #13033 Stefan Eissing (4 Mar 2024) - lib: further send/upload handling polish - Move all the "upload_done" handling to request.c - add possibility to abort sending of a request - add `Curl_req_done_sending()` for checks - transfer.c: readwrite_upload() now clean - removing data->state.ulbuf and data->req.upload_fromhere - as well as data->req.upload_present - set data->req.upload_done on having read all from the client and completely flushed the send buffer - tftp, remove setting of data->req.upload_fromhere - serves no purpose as `upload_present` is not set and the data itself is directly `sendto()` anyway - smtp, make upload EOB conversion a client reader - xfer_ulbuf addition - add xfer_ulbuf for borrowing, similar to xfer_buf - use in file upload - use in c-hyper body sending - h1-proxy, remove init of data->state.uilbuf that is never used - smb, add own send_buf instead of using data->state.ulbuf Closes #13010 Daniel Stenberg (4 Mar 2024) - RELEASE-NOTES: synced kpcyrd (3 Mar 2024) - rustls: fix two warnings related to number types Reported-by: Gisle Vanem Follow-up to #12989 Closes #13017 Stefan Eissing (3 Mar 2024) - bufq: writing into a softlimit queue cannot be partial - when unable to obtain a new chunk on a softlimit bufq, this is an allocation error and needs to be reported as such. - writes into a soflimit bufq never must be partial success Reported-by: Dan Fandrich Fixes #13020 Closes #13023 Dan Fandrich (2 Mar 2024) - configure: Don't build shell completions when disabled With the recent changes to completion file building, the files were built always and only installation was selectively disabled. Now, when they are disabled they aren't even built, avoiding a build-time error in environments where it's not possible to run the curl binary that was just created (e.g. if library paths were not set up correctly). Follow-up to 0f7aba83c Reported-by: av223119 on github Fixes #13027 Closes #13030 Jay Satiro (2 Mar 2024) - cmdline-opts/_EXITCODES: sync with libcurl-errors - Add error code 100 (CURLE_TOO_LARGE) to the list of error codes that can be returned by the curl tool. Closes https://github.com/curl/curl/pull/13015 Stefan Eissing (1 Mar 2024) - hyper: disable test1598 due to lack of trailer support Follow-up to 50838095 Closes #13016 Dan Fandrich (1 Mar 2024) - ftp: Mark a const buffer as const - appveyor: Properly skip if only CircleCI is changed - docs: Update minimal binary size in INSTALL.md Include more options to reduce binary size. - configure: Don't make shell completions without perl The code that attempted to skip building the shell completions didn't work properly and tried to build them even if perl wasn't available. This step, as well as the install step, is now properly skipped without perl. Follow-up to 89733e2dd Closes #13022 RainRat (1 Mar 2024) - misc: Fix typos in docs and lib This fixes miscellaneous typos and duplicated words in the docs, lib and test comments and a few user facing errorstrings. Author: RainRat on Github Reviewed-by: Daniel Gustafsson Reviewed-by: Dan Fandrich Closes: #13019 Dan Fandrich (29 Feb 2024) - configure: build & install shell completions when enabled The --with-fish-functions-dir and --with-zsh-functions-dir options currently have no effect on a normal build because the scripts/ directory where they're used is not built. Add scripts/ to a normal build and change the completion options to default to off to preserve the existing behaviour. Closes: #12906 - github/labeler: improve the match patterns Stefan Eissing (28 Feb 2024) - tests: add test1598 for POST with trailers - test POST fields with trailers and chunked encoding Ref: #12938 Closes #13009 Daniel Stenberg (28 Feb 2024) - cmdline-opts/_VERSION: provide %VERSION correctly ... so that it does not get included verbatim in the output. Fixes a regression shipped in 8.6.0. Also fix a format mistake in form.md Closes #13008 Stefan Eissing (28 Feb 2024) - lib: Curl_read/Curl_write clarifications - replace `Curl_read()`, `Curl_write()` and `Curl_nwrite()` to clarify when and at what level they operate - send/recv of transfer related data is now done via `Curl_xfer_send()/Curl_xfer_recv()` which no longer has socket/socketindex as parameter. It decides on the transfer setup of `conn->sockfd` and `conn->writesockfd` on which connection filter chain to operate. - send/recv on a specific connection filter chain is done via `Curl_conn_send()/Curl_conn_recv()` which get the socket index as parameter. - rename `Curl_setup_transfer()` to `Curl_xfer_setup()` for naming consistency - clarify that the special CURLE_AGAIN hangling to return `CURLE_OK` with length 0 only applies to `Curl_xfer_send()` and CURLE_AGAIN is returned by all other send() variants. - fix a bug in websocket `curl_ws_recv()` that mixed up data when it arrived in more than a single chunk (to be made into a sperate PR, also) Added as documented [in CLIENT-READER.md](https://github.com/curl/curl/blob/5b1f31dfbab8aef467c419c68 aa06dc738cb75d4/docs/CLIENT-READERS.md). - old `Curl_buffer_send()` completely replaced by new `Curl_req_send()` - old `Curl_fillreadbuffer()` replaced with `Curl_client_read()` - HTTP chunked uploads are now formatted in a client reader added when needed. - FTP line-end conversions are done in a client reader added when needed. - when sending requests headers, remaining buffer space is filled with body data for sending in "one go". This is independent of the request body size. Resolves #12938 as now small and large requests have the same code path. Changes done to test cases: - test513: now fails before sending request headers as this initial "client read" triggers the setup fault. Behaves now the same as in hyper build - test547, test555, test1620: fix the length check in the lib code to only fail for reads *smaller* than expected. This was a bug in the test code that never triggered in the old implementation. Closes #12969 Daniel Gustafsson (28 Feb 2024) - curldown: Fix email address in Copyright The curldown conversion accidentally replaced daniel@haxx.se with just daniel.se. This reverts back to the proper email address in the curldown docs as well as in a few other stray places where it was incorrect (while unrelated to curldown). Reviewed-by: Daniel Stenberg Closes: #12997 Daniel Stenberg (28 Feb 2024) - getparam: make --ftp-ssl work again Follow-up to 9e4e527 which accidentally broke it Reported-by: Jordan Brown Fixes #13006 Closes #13007 - KNOWN_BUGS: IMAPS connection fails with rustls error Closes #10457 - KNOWN_BUGS: FTPS upload, FileZilla, GnuTLS and close_notify Closes #11383 - KNOWN_BUGS: Implicit FTPS upload timeout Closes #11720 - KNOWN_BUGS: HTTP/2 prior knowledge over proxy Closes #12641 - TODO: build HTTP/3 with OpenSSL and nghttp3 using cmake Closes #12988 - TODO: Select signature algorithms Closes #12982 - examples: use present tense in comments remove "will" and some other word fixes Closes #13003 - docs: more language cleanups - present tense - avoid bad words Closes #13003 Daniel Gustafsson (27 Feb 2024) - setopt: Fix disabling all protocols When disabling all protocols without enabling any, the resulting set of allowed protocols remained the default set. Clearing the allowed set before inspecting the passed value from --proto make the set empty even in the errorpath of no protocols enabled. Co-authored-by: Dan Fandrich Reported-by: Dan Fandrich Reviewed-by: Daniel Stenberg Closes: #13004 Andreas Kiefer (27 Feb 2024) - fopen: fix narrowing conversion warning on 32-bit Android This was fixed in commit 06dc599405f, but came back in commit 03cb1ff4d62. When building for 32-bit ARM or x86 Android, `st_mode` is defined as `unsigned int` instead of `mode_t`, resulting in a `-Wimplicit-int-conversion` clang warning because `mode_t` is `unsigned short`. Add a cast to silence the warning, but only for 32-bit Android builds, because other architectures and platforms are not affected. Ref: https://android.googlesource.com/platform/bionic/+/refs/tags/ndk-r25c/li bc/include/sys/stat.h#86 Closes https://github.com/curl/curl/pull/12998 Stefan Eissing (27 Feb 2024) - lib: Curl_read/Curl_write clarifications - replace `Curl_read()`, `Curl_write()` and `Curl_nwrite()` to clarify when and at what level they operate - send/recv of transfer related data is now done via `Curl_xfer_send()/Curl_xfer_recv()` which no longer has socket/socketindex as parameter. It decides on the transfer setup of `conn->sockfd` and `conn->writesockfd` on which connection filter chain to operate. - send/recv on a specific connection filter chain is done via `Curl_conn_send()/Curl_conn_recv()` which get the socket index as parameter. - rename `Curl_setup_transfer()` to `Curl_xfer_setup()` for naming consistency - clarify that the special CURLE_AGAIN hangling to return `CURLE_OK` with length 0 only applies to `Curl_xfer_send()` and CURLE_AGAIN is returned by all other send() variants. - fix a bug in websocket `curl_ws_recv()` that mixed up data when it arrived in more than a single chunk The method for sending not just raw bytes, but bytes that are either "headers" or "body". The send abstraction stack, to to bottom, now is: * `Curl_req_send()`: has parameter to indicate amount of header bytes, buffers all data. * `Curl_xfer_send()`: knows on which socket index to send, returns amount of bytes sent. * `Curl_conn_send()`: called with socket index, returns amount of bytes sent. In addition there is `Curl_req_flush()` for writing out all buffered bytes. `Curl_req_send()` is active for requests without body, `Curl_buffer_send()` still being used for others. This is because the special quirks need to be addressed in future parts: * `expect-100` handling * `Curl_fillreadbuffer()` needs to add directly to the new `data->req.sendbuf` * special body handlings, like `chunked` encodings and line end conversions will be moved into something like a Client Reader. In functions of the pattern `CURLcode xxx_send(..., ssize_t *written)`, replace the `ssize_t` with a `size_t`. It makes no sense to allow for negativ e values as the returned `CURLcode` already specifies error conditions. This allows easier handling of lengths without casting. Closes #12964 Daniel Stenberg (27 Feb 2024) - multi: make add_handle free any multi_easy If the easy handle that is being added to a multi handle has previously been used for curl_easy_perform(), there is a private multi handle here that we can kill off. While it flushes some caches etc for the easy handle would it be used for an easy interface transfer again after being used in the multi stack, this cleanup simplifies behavior and uses less memory. Closes #12992 - docs: use present tense avoid "will", detect "will" as a bad word in the CI Also line wrapped a bunch of paragraphs Closes #13001 - CURLOPT_SSL_CTX_FUNCTION.md: no promises of lifetime after return ... and cleanup other language. Closes #12999 Stefan Eissing (27 Feb 2024) - lib: send rework Curl_read/Curl_write clarifications - replace `Curl_read()`, `Curl_write()` and `Curl_nwrite()` to 1clarify when and at what level they operate - send/recv of transfer related data is now done via `Curl_xfer_send()/Curl_xfer_recv()` which no longer has socket/socketindex as parameter. It decides on the transfer setup of `conn->sockfd` and `conn->writesockfd` on which connection filter chain to operate. - send/recv on a specific connection filter chain is done via `Curl_conn_send()/Curl_conn_recv()` which get the socket index as parameter. - rename `Curl_setup_transfer()` to `Curl_xfer_setup()` for naming consistency - clarify that the special CURLE_AGAIN handling to return `CURLE_OK` with length 0 only applies to `Curl_xfer_send()` and CURLE_AGAIN is returned by all other send() variants. SingleRequest reshuffling - move functions into request.[ch] - differentiate between reset and free - add Curl_req_done() to perform last actions - add a send `bufq` to SingleRequest for future use in keeping upload data Closes #12963 Daniel Stenberg (26 Feb 2024) - RELEASE-NOTES: synced - http_chunks: remove unused 'endptr' variable Closes #12996 Louis Solofrizzo (26 Feb 2024) - lib: initialize output pointers to NULL before calling strto[ff,l,ul] In order to make MSAN happy: ==2200945==WARNING: MemorySanitizer: use-of-uninitialized-value #0 0x596f3b3ed246 in curlx_strtoofft [...]/libcurl/src/lib/strtoofft.c:23 9:11 #1 0x596f3b402156 in Curl_httpchunk_read [...]/libcurl/src/lib/http_chunk s.c:149:12 #2 0x596f3b348550 in readwrite_data [...]/libcurl/src/lib/transfer.c:607: 11 [...] ==2202041==WARNING: MemorySanitizer: use-of-uninitialized-value #0 0x5a3fab66a72a in Curl_parse_port [...]/libcurl/src/lib/urlapi.c:547:8 #1 0x5a3fab650645 in parse_authority [...]/libcurl/src/lib/urlapi.c:796:1 2 #2 0x5a3fab6740f6 in parseurl [...]/libcurl/src/lib/urlapi.c:1176:16 #3 0x5a3fab664fc5 in parseurl_and_replace [...]/libcurl/src/lib/urlapi.c: 1342:12 [...] ==2202320==WARNING: MemorySanitizer: use-of-uninitialized-value #0 0x569076a0d6b0 in ipv4_normalize [...]/libcurl/src/lib/urlapi.c:683:12 #1 0x5690769f2820 in parse_authority [...]/libcurl/src/lib/urlapi.c:803:1 0 #2 0x569076a160f6 in parseurl [...]/libcurl/src/lib/urlapi.c:1176:16 #3 0x569076a06fc5 in parseurl_and_replace [...]/libcurl/src/lib/urlapi.c: 1342:12 [...] Signed-off-by: Louis Solofrizzo Closes #12995 Stefan Eissing (26 Feb 2024) - lib: move client writer into own source Refactoring of the client writer that passes the data to the client/application's callback functions. - split out into own source cw-out.[ch] from sendf.c - move tempwrite and tempcount from data->state into the context of the client writer - redesign the 3 tempwrite dynbufs as a linked list of dynbufs. On paused transfers, this allows to "record" interleaved HEADER/BODY chunks to be "played back" in the same order on unpausing. - keep the overall size limit of all buffered data to DYN_PAUSE_BUFFER. On exceeding that, return CURLE_TOO_LARGE instead of CURLE_OUT_OF_MEMORY as before. - add method to be called when a transfer is DONE to allow writing of any data still buffered - when paused, record HEADER writes exactly as they come for later playback. HEADERs are documented to be written one-by-one. Closes #12898 - urldata: move authneg bit from conn to Curl_easy - from `conn->bits.authneg` to `data->req.authneg` - this is a property of the request about to be made and not a property of the connection - in multiuse connections, transfer could step on each others toes here potentially. Closes #12949 - c-hyper: add header collection writer in hyper builds Closes #12880 - http: move headers collecting to writer - add a client writer that does "push" response headers written to the client if the headers api is enabled - remove special handling in sendf.c - needs to be installed very early on connection setup to catch CONNECT response headers Closes #12880 - sendf: Curl_client_write(), make passed in buf const Michał Antoniak (26 Feb 2024) - lib: remove curl_mimepart object when CURL_DISABLE_MIME Remove curl_mimepart object from UserDefined structure when CURL_DISABLE_MIME flag is active. Reduce size of UserDefined structure. Also remove unreachable code: when CURL_DISABLE_MIME is set, httpreq can never have HTTPREQ_POST_MIME value and the same goes for the CURL_DISABLE_FORM_API flag and the HTTPREQ_POST_FORM value Closes #12948 kpcyrd (26 Feb 2024) - rustls: make curl compile with 0.12.0 Closes #12989 Daniel Stenberg (26 Feb 2024) - strtoofft: fix the overflow check ... to not rely on wrapping, since it is an undefined behavior that is not what always might happen. This is in our private strtoff() parser function, used only on platforms without a native version. Reported-by: vulnerabilityspotter on hackerone Closes #12990 - libssh/libssh2: return error on too big range If trying to get the range 0 - 2^63 and the remote file is 2^63 bytes or larger. Fixes #12983 Closes #12984 Scott Talbert (24 Feb 2024) - setopt: fix check for CURLOPT_PROXY_TLSAUTH_TYPE value Prior to this change CURLOPT_PROXY_TLSAUTH_TYPE would return CURLE_BAD_FUNCTION_ARGUMENT on any type other than NULL. Since there is only one type of TLS auth and it is also the default (SRP) the TLS auth would work anyway. Closes https://github.com/curl/curl/pull/12981 Jay Satiro (24 Feb 2024) - mprintf: fix format prefix I32/I64 for windows compilers - Support I32 & I64 (eg: %I64d) for all Win32 builds. Prior to this change mprintf support for the I format prefix, which is a Microsoft extension, was dependent on the compiler used. When Borland compiler support was removed in fd7ef00f the prefix was then no longer supported for that compiler; however since it's still possible to build with Borland I'm restoring support for the prefix in this way. Reported-by: Paweł Witas Fixes https://github.com/curl/curl/issues/12944 Closes https://github.com/curl/curl/pull/12950 Daniel Stenberg (23 Feb 2024) - cd2nroff: gen: make `\>` in input to render as plain '>' in output The same (copy and pasted) fix/mistake as in gen.pl - gen: make `\>` in input to render as plain '>' in output Reported-by: Gisle Vanem Fixes #12977 Closes #12978 Fabrice Fontaine (23 Feb 2024) - configure.ac: find libpsl with pkg-config Find libpsl with pkg-config to avoid static build failures. Ref: http://autobuild.buildroot.org/results/1fb15e1a99472c403d0d3b1a688902f32 e78d002 Signed-off-by: Fabrice Fontaine Closes #12947 Daniel Stenberg (23 Feb 2024) - BUG-BOUNTY.md: clarify that the curl security team decides Closes #12975 - THANKS: add bug reporter from #740 Ref: https://github.com/curl/curl/issues/740 Stefan Eissing (22 Feb 2024) - multi: fix multi_sock handling of select_bits - OR the event bitmask to data->state.select_bits instead of overwriting them. They are cleared again on use. Reported-by: 5533asdg on github Fixes #12971 Closes #12972 Daniel Stenberg (22 Feb 2024) - curlver: bump to 8.7.0 for next release - RELEASE-NOTES: synced - write-out: add '%{proxy_used}' Returns 1 if the previous transfer used a proxy, otherwise 0. Useful to for example determine if a `NOPROXY` pattern matched the hostname or not. Extended test 970 and 972 - CURLINFO_USED_PROXY: return bool whether the proxy was used Adds test536 to verify Closes #12719 - sha512_256: remove the cast macro, minor language/format edits Follow-up to cbe41d151d6a100c Closes #12966 Stefan Eissing (20 Feb 2024) - DoH: add trace configuration - refs #12397 where it is dicussed how to en-/disable verbose output of DoH operations - introducing `struct curl_trc_feat` to track a curl feature for tracing - adding `data->state.feat` optionally pointing to the feature a transfer belongs to - adding trace functions and verbosity checks on features - using trace feature in DoH code - documenting `doh` as feature for `--trace-config` Closes #12411 - websocket: fix curl_ws_recv() - when data arrived in several chunks, the collection into the passed buffer always started at offset 0, overwriting the data already there. adding test_20_07 to verify fix - debug environment var CURL_WS_CHUNK_SIZE can be used to influence the buffer chunk size used for en-/decoding. Closes #12945 Evgeny Grin (Karlson2k) (20 Feb 2024) - digest: support SHA-512/256 Also fix the tests. New implementation tested with GNU libmicrohttpd. The new numbers in tests are real SHA-512/256 numbers (not just some random ;) numbers ). - tests: add SHA-512/256 unit test - SHA-512/256: implement hash algorithm Closes #12897 - curl_setup.h: add curl_uint64_t internal type The unsigned version of curl_off_t basically Daniel Stenberg (20 Feb 2024) - docs: dist curl*.1 and install without perl Drop docs/mk-ca-bundle.1 from the tarball. It can be generated at will. Closes #12959 Fixes #12921 Reported-by: Michael Forney Stefan Eissing (20 Feb 2024) - OpenSSL QUIC: adapt to v3.3.x - set our idle timeout as transport parameter - query negotiated idle timeout for connection alive checks - query number of available bidi streams on a connection - use write_ex2 with SSL_WRITE_FLAG_CONCLUDE to signal EOF on last chunk write, so stream close does not require an additional QUIC packet Closes #12933 Ramiro Garcia (19 Feb 2024) - MANUAL.md: fix typo Closes #12965 Daniel Stenberg (19 Feb 2024) - BINDINGS: add mcurl, the python binding Ref: #12956 Closes #12962 - mk-ca-bundle.md: cleanups and polish Closes #12958 - spellcheck.yml: remove .1/.3 handling, clean all man page .md files Since we generate all .1 and .3 files from markdown now, we can limit the spellcheck to the markdown versions only. Closes #12960 - libcurl-docs: cleanups CURLMOPT_SOCKETDATA.md: fix typo CURLMOPT_TIMERDATA.md: fix typo CURLOPT_COOKIELIST.m: quote strings CURLOPT_PREREQFUNCTION.md: quote variable names CURLOPT_TCP_NODELAY.md: rephrased to please spell checker CURLOPT_WILDCARDMATCH.md: rephrased libcurl-tutorial.md: use correct option name curl_global_init_mem.md: quote headers curl_easy_getinfo.md: use correct symbol names in headers curl_global_trace.md: quote some headers curl_ws_meta.md: quote struct field names libcurl-env.md: quote headers - cd2nroff: remove backticks from titles - RELEASE-NOTES: synced Stefan Eissing (18 Feb 2024) - http_chunks: fix the accounting of consumed bytes Prior to this change chunks were handled correctly although in verbose mode libcurl could incorrectly warn of "Leftovers after chunking" even if there were none. Reported-by: Michael Kaufmann Fixes https://github.com/curl/curl/issues/12937 Closes https://github.com/curl/curl/pull/12939 - file: use xfer buf for file:// transfers - For file:// transfers use the multi handle's transfer buffer for up- and downloads. Prior to this change a6c9a33 (precedes 8.6.0) changed the file:// transfers to use a smaller stack based buffer, and that caused a significant performance decrease in Windows. Bug: https://github.com/curl/curl/issues/12750#issuecomment-1920103086 Reported-by: edmcln@users.noreply.github.com Closes https://github.com/curl/curl/pull/12932 Karthikdasari0423 (18 Feb 2024) - HTTP3.md: always run nghttp3 submodule init - For consistency change all 'build nghttp3' commands to run submodule init after cloning, even if the branch does not have submodules. Follow-up to 5a4b2f93 and 4f794558. Closes https://github.com/curl/curl/pull/12928 LeeRiva (18 Feb 2024) - CURLOPT_POSTQUOTE.md: fix typo Closes https://github.com/curl/curl/pull/12926 Evgeny Grin (Karlson2k) (18 Feb 2024) - checksrc.pl: fix handling .checksrc with CRLF - When parsing .checksrc chomp the (CR)LF line ending. Prior to this change on Windows checksrc.pl would not process the symbols in .checksrc properly, since many git repos in Windows use auto crlf to check out files with CRLF line endings. Closes https://github.com/curl/curl/pull/12924 Richard Levitte (18 Feb 2024) - cmake: fix install for older CMake versions - Generate the docs install list by using a foreach loop instead of LIST:TRANSFORM since older CMake can't handle the latter. Reported-by: Dan Fandrich Fixes https://github.com/curl/curl/issues/12920 Closes https://github.com/curl/curl/pull/12922 Stefan Eissing (16 Feb 2024) - vtls: fix tls proxy peer verification - When verifying a proxy certificate for an ip address, use the correct ip family. Prior to this change the "connection" ip family was used, which was not necessarily the same. Reported-by: HsiehYuho@users.noreply.github.com Fixes https://github.com/curl/curl/issues/12831 Closes https://github.com/curl/curl/pull/12931 Dan Fandrich (15 Feb 2024) - CI: Bump the Circle CI base Ubuntu image to the latest 20.04 The previous ones are going to be removed soon, plus the new ones include all the fixes since then. Jay Satiro (13 Feb 2024) - transfer: improve Windows SO_SNDBUF update limit - Change the 1 second SO_SNDBUF update limit from per transfer to per connection. Prior to this change many transfers over the same connection could cause many SO_SNDBUF updates made to that connection per second, which was unnecessary. Closes https://github.com/curl/curl/pull/12911 - schannel: fix hang on unexpected server close - Treat TLS connection close (either due to a close_notify from the server or just closed due to receiving 0) as pending data. This is because in some cases schannel_recv knows the connection is closed but has to return actual pending data so it can't return 0 or an error to indicate no more data. In this case schannel_recv must be called again, which only happens if readwrite_data sees that there is still pending data. Prior to this change if the total size of the body that libcurl expected to receive from the server was unknown then it was possible under some network conditions that libcurl would hang waiting to receive more data, when in fact a close_notify alert indicating no more data would be sent was already processed. Fixes https://github.com/curl/curl/issues/12894 Closes https://github.com/curl/curl/pull/12910 Daniel Stenberg (10 Feb 2024) - KNOWN_BUGS: FTP upload fails if remebered dir is deleted Closes #12181 Closes #12923 Michał Antoniak (10 Feb 2024) - mbedtls: use mbedtls_ssl_conf_{min|max}_tls_version ... instead of the deprecated mbedtls_ssl_conf_{min|max}_version Closes #12905 Dan Fandrich (9 Feb 2024) - CI: bump to actions/cache@v4 to avoid warning Evgeny Grin (Karlson2k) (9 Feb 2024) - test1165: improve pattern matching * Fix excluded digits at the end of the symbols ('CURL_DISABLE_POP3' was checked as 'CURL_DISABLE_POP') Closes #12903 Dan Fandrich (9 Feb 2024) - scripts: Fix cijobs.pl for Azure and GHA The spacing in the yaml files changed. Daniel Stenberg (9 Feb 2024) - RELEASE-NOTES: synced - TODO: use pkg-config to find libpsl Closes #12919 - TODO: avoid nroff Instead of adjusting roffit, skip the nroff step. Closes #12919 Dan Fandrich (9 Feb 2024) - Revert "CI: run Circle macOS builds on x86 for now" This reverts commit 2683de3078eadc86d9b182e7417f4ee75a247e2c. ARM resources are now available in Circle CI, so run these builds on ARM again. This platform needs explicit paths set to libpsl and its dependency icu4c. Follow-up to 2683de30 Closes #12635 Viktor Szakats (9 Feb 2024) - cmake: add warning for using TLS libraries without 1.3 support Closes #12900 Daniel Stenberg (9 Feb 2024) - configure: add warning for using TLS libraries without 1.3 support Closes #12900 Michał Antoniak (9 Feb 2024) - mbedtls: fix building when MBEDTLS_X509_REMOVE_INFO flag is defined Closes #12904 Stefan Eissing (9 Feb 2024) - ftp: fix socket wait activity in ftp_domore_getsock - when waiting on the data connection, always add the control socket to the pollset on state STOP or let the pingpong add the socket according to its needs. Reported-by: Fabian Vogt Fixes #12901 Closes #12913 Daniel Stenberg (9 Feb 2024) - dist: make sure the http tests are in the tarball Fixes #12914 Reported-by: Fabian Vogt Closes #12917 Stefan Eissing (9 Feb 2024) - multi: add xfer_buf to multi handle - can be borrowed by transfer during recv-write operation - needs to be released before borrowing again - adjustis size to `data->set.buffer_size` - used in transfer.c readwrite_data() Closes #12805 Daniel Stenberg (9 Feb 2024) - write-out.md: clarify error handling details - it gets used even if the transfer fails - it does not cause error to be returned even if it fails Closes #12909 Stefan Eissing (8 Feb 2024) - ftp: do lineend conversions in client writer - remove the ftp special handling from sendf.c - let ftp_do() add a client writer that does the linened conversions - change the lineend conversion to no longer modify the passed buffer, but write smaller chunks to the next cwriter instead. The inefficiency of this will be mitigated once we add output buffering for all client writes. Closes #12878 - ftp: tracing improvements - trace socketindex for connection filters when not the first - trace socket fd in tcp - trace pollset adjusts in vtls Closes #12902 Karthikdasari0423 (8 Feb 2024) - HTTP3.md: adjust the OpenSSL QUIC install instructions tried installing with old steps but failed tried with newly added setps and able to build ``` root@ubuntu:~/curl# ./src/curl -V /root/curl/src/.libs/curl: /lib/x86_64-linux-gnu/libssl.so.3: version `OPENSS L_3.2.0' not found (required by /root/curl/lib/.libs/libcurl.so.4) root@ubuntu:~/curl# ``` ``` root@ubuntu:~/curl# ./src/curl -V curl 8.6.1-DEV (x86_64-pc-linux-gnu) libcurl/8.6.1-DEV OpenSSL/3.2.0 zlib/1.2 .11 brotli/1.0.9 libpsl/0.21.0 nghttp3/1.1.0 OpenLDAP/2.5.16 Release-Date: [unreleased] Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns ldap ldaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp Features: alt-svc AsynchDNS brotli HSTS HTTP3 HTTPS-proxy IPv6 Largefile libz NTLM PSL SSL threadsafe TLS-SRP UnixSockets root@ubuntu:~/curl# ``` Closes #12896 Daniel Stenberg (8 Feb 2024) - TODO: align the TOC with the header - docs: make sure curl.1 is included in dist tarballs Ref: https://github.com/curl/curl/issues/12832#issuecomment-1933271873 Closes #12892 Karthikdasari0423 (8 Feb 2024) - HTTP3.md: remove quiche word in Openssl 3.2 Closes #12893 Daniel Stenberg (7 Feb 2024) - curl: when allocating variables, add the name into the struct This saves the name from being an extra separate allocation. Closes #12891 - lib582: remove code causing warning that is never run The previous realloc code in this code could trigger a compiler warning, but since that code path cannot happen in normal circumstances it now instead exits with an error message there. Ref: #12887 Closes #12890 Stefan Eissing (7 Feb 2024) - vtls: revert "receive max buffer" + add test case - add test_05_04 for requests using http/1.0, http/1.1 and h2 against an Apache resource that does an unclean TLS shutdown. - revert special workarund in openssl.c for suppressing shutdown errors on multiplexed connections - vlts.c restore to its state before 9a90c9dd64d2f03601833a70786d485851bd1b53 Fixes #12885 Fixes #12844 Closes #12848 Daniel Stenberg (7 Feb 2024) - tests: support setting/using blank content env variables - test450: remove --config from the keywords - test2080: change return code - test428: add --config as a keyword - test428: disable on Windows due to CI problems - curl: exit on config file parser errors Like when trying to import an environment variable that does not exist. Also fix a bug for reading env variables when there is a default value set. Bug: https://curl.se/mail/archive-2024-02/0008.html Reported-by: Brett Buddin Add test 462 to verify. Closes #12862 Daniel Szmulewicz (7 Feb 2024) - CURLOPT_WRITEFUNCTION.md: typo fix The maximum amount of body data that is passed to the write callback is defined in the curl.h header file Closes #12889 Daniel Stenberg (7 Feb 2024) - lib: convert Curl_get_line to use dynbuf Create the line in a dynbuf. Aborts the reading of the file on errors. Avoids having to always allocate maximum amount from the start. Avoids direct malloc. Closes #12846 - KNOWN_BUGS: unicode on Windows Closes #11461 Closes #12231 Closes #12883 - tool_operate: change precedence of server Retry-After time - When calculating the retry time, no longer allow a server's requested Retry-After time to take precedence over a longer retry time (either default algorithmic or user-specified). Prior to this change the server's Retry-After time took precedence over curl's retry time in all cases, but that's not always practical for short Retry-After times depending on how busy the server is. Bug: https://curl.se/mail/archive-2024-01/0022.html Reported-by: Dirk Hünniger Closes https://github.com/curl/curl/pull/12871 - cmdline-docs: quote and angle bracket cleanup - make sure angle brackets are escaped - remove a lot of superfluous double quotes - replace several double quotes with backticks To make nicer-looking markdown. Closes #12884 - badwords: use hostname, not host name and username, filename - consistently. Fixed the patterns in badwords.txt to catch these. Closes #12888 Viktor Szakats (6 Feb 2024) - cmake: fix function description in comment [ci skip] Closes #12879 Daniel Stenberg (6 Feb 2024) - header.md: remove backslash, make nicer markdown - remove a leftover backslash before a dash - use backticks for "code" strings Closes #12877 - docs: add mk-ca-bundle.1 to dist ... which also makes it get built. But don't build this or curl-config.1 if build docs is disabled. Closes #12875 Stefan Eissing (6 Feb 2024) - https-proxy: use IP address and cert with ip in alt names - improve info logging when peer verification fails to indicate if DNS name or ip address has been tried to match - add test case for contacting https proxy with ip address - add pytest env check on loaded credentials and re-issue when they are no longer valid - disable proxy ip address test for bearssl, since not supported there Ref: #12831 Closes #12838 Jiawen Geng (6 Feb 2024) - docs: add necessary setup for nghttp3 Now nghttp3 has submodules https://github.com/ngtcp2/nghttp3/blob/main/.gitmodules Closes #12859 Peter Krefting (6 Feb 2024) - version: allow building with ancient libpsl The psl_check_version_number() API was added in libpsl 0.11.0. CentOS 7 ships with version 0.7.0 which lacks this API. Revert to using the older versioning API if we detect an old libpsl version. Follow-up to 72bd88adde0e8cf6e63644a7d6df1da01a399db4 Bug: https://curl.se/mail/archive-2024-02/0004.html Reported-by: Scott Mutter Closes #12872 Daniel Stenberg (6 Feb 2024) - TODO: Support latest rustls Closes #12737 Closes #12874 - docs: make curldown do angle brackets like markdown Make sure we use \< and \> in markdown all over so that it renders correctly, on GitHub and elsewhere. cd2nroff now outputs a warning if it finds an unescaled angle bracket. Ref: #12854 Closes #12869 - docs: fix the --disable-docs for autotools Follow-up to 541321507e386 Closes #12870 - RELEASE-NOTES: synced - libcurl-security.md: Active FTP passes on the local IP address Reported-by: Harry Sintonen Closes #12867 Stefan Eissing (5 Feb 2024) - configure: do not link with nghttp3 unless necessary Fixes #12833 Closes #12864 Reported-by: Ryan Carsten Schmidt Daniel Stenberg (5 Feb 2024) - THANKS: add Dmitry Tretyakov ... since I missed to give credit to the report in the fix of #12861 Stefan Eissing (5 Feb 2024) - openssl-quic: check on Windows that socket conv to int is possible Fixes #12861 Closes #12865 Daniel Stenberg (5 Feb 2024) - tool_cb_hdr: only parse etag + content-disposition for 2xx ... and ignore them for other response codes. Reported-by: Harry Sintonen Closes #12866 - md4: include strdup.h for the memdup proto Reported-by: Erik Schnetter Fixes #12849 Closes #12863 Joel Depooter (5 Feb 2024) - docs: add missing slashes to SChannel client certificate documentation When setting the CURLOPT_SSLCERT option to a certificate thumprint, it is required to have a backslash between the "store location", "store name" and "thumbprint" tokens. These slashes were present in the previous documentation, but were missed in the transition to markdown documentation. Closes #12854 Stefan Eissing (5 Feb 2024) - HTTP/2: write response directly - use the new `Curl_xfer_write_resp()` to write incoming responses directly to the client - eliminates `stream->recvbuf` - memory consumption on parallel transfers minimized Closes #12828 Daniel Stenberg (5 Feb 2024) - cookie.md: provide an example sending a fixed cookie Closes #12868 Lars Kellogg-Stedman (5 Feb 2024) - ALTSVC.md: correct a typo The ALPN documentation erroneously referred to a "host number" instead of a "port number". Closes #12852 Boris Verkhovskiy (5 Feb 2024) - proxy1.0.md: fix example Closes #12856 Chris Webb (5 Feb 2024) - configure: add --disable-docs flag Building man pages from curldown sources now requires perl. Add a --disable-docs flag to configure to enable building and installing without documentation where perl is not available or man pages are not required. This is selected automatically (with a warning) when perl is not found by configure. Fixes #12832 Closes #12857 Faraz Fallahi (5 Feb 2024) - connect.c: fix typo Closes #12858 Daniel Stenberg (1 Feb 2024) - sendf: ignore response body to HEAD and mark the stream for close, but return OK since the response this far was ok - if headers were received. Partly because this is what curl has done traditionally. Test 499 verifies. Updates test 689. Reported-by: Sergey Bronnikov Bug: https://curl.se/mail/lib-2024-02/0000.html Closes #12842 - ftp: treat a 226 arriving before data as a signal to read data For active mode transfers. Due to some interesting timing, curl can sometimes get the 226 (transfer complete) over the control channel first, before the data connection signals readability. If this happens, use that as a signal to check the data connection. Additionally, set the socket filter in listen mode *before* the PORT/EPRT command is issued, to reduce the risk that the little time gap could interfere. This issue never reproduced for me on Debian and takes several hundred rounds for me to trigger on my mac. Reported-by: Stefan Eissing Fixes #12823 Closes #12841 Patrick Monnerat (1 Feb 2024) - OS400: avoid using awk in the build scripts Awk is a PASE program and its use may cause a failure depending on the CCSID of the calling script (IBM bug?). For this reason, revert to an sed-only solution to extract the exported symbols from the header files. Closes #12826 Jan Macku (1 Feb 2024) - docs: remove `mk-ca-bundle.1` from `man_MANS` It was accidentally added in https://github.com/curl/curl/pull/12730 Co-authored-by: Lukáš Zaoral Signed-off-by: Jan Macku Follow-up to eefcc1bda4bccd800f5a56a0fe17a2f44a96e88b Closes #12843 Daniel Stenberg (1 Feb 2024) - RELEASE-NOTES: synced and bump to 8.6.1 for now - cmdline-docs/Makefile: avoid using a fixed temp file name By appending the pid number two different runs at the same time will not trample over the same file. Reported-by: Jon Rumsey Fixes #12829 Closes #12839 - asyn-thread: use wakeup_close to close the read descriptor Reported-by: Dan Fandrich Ref: #12834 Closes #12836 Stefan Eissing (1 Feb 2024) - ntml_wb: fix buffer type typo Closes #12825 Daniel Stenberg (1 Feb 2024) - tool_operate: do not set CURLOPT_QUICK_EXIT in debug builds Since it allows (small) memory leaks that interfere with torture tests and regular memory-leak checks. Reported-by: Dan Fandrich Fixes #12834 Closes #12835 Boris Verkhovskiy (31 Jan 2024) - form-string.md: correct the example Closes #12822 Version 8.6.0 (31 Jan 2024) Daniel Stenberg (31 Jan 2024) - RELEASE-NOTES: synced curl 8.6.0 - THANKS: new contributors from 8.5.0 Jay Satiro (31 Jan 2024) - cd2nroff: use perl 'strict' and 'warnings' - Use strict and warnings pragmas. - If open() fails then show the reason. - Set STDIN io layer :crlf so that input is properly read on Windows. - When STDIN is used as input, the filename $f is now set to "STDIN". Various error messages in single() use $f for the filename and this way it is not undefined when STDIN. Closes https://github.com/curl/curl/pull/12819 Daniel Stenberg (30 Jan 2024) - cd2nroff: fix duplicate output issue Assisted-by: Jay Satiro Fixes https://github.com/curl/curl-www/issues/321 Closes #12818 - lib: error out on multissl + http3 Since the QUIC/h3 code has no knowledge or handling of multissl it might bring unintended consequences if we allow it. configure, cmake and curl_setup.h all now reject this combination. Assisted-by: Viktor Szakats Assisted-by: Gisle Vanem Ref: #12806 Closes #12807 Patrick Monnerat (29 Jan 2024) - OS400: sync ILE/RPG binding Also do not force git CRLF line endings on *.cmd files for OS400. Closes #12815 Viktor Szakats (28 Jan 2024) - build: delete/replace 3 more clang warning pragmas - tool_msgs: delete redundant `-Wformat-nonliteral` suppression pragma. - whitespace formatting in `mprintf.h`, lib518, lib537. - lib518: fix wrong variable in `sizeof()`. - lib518: bump variables to `rlim_t`. Follow-up to e2b394106d543c4615a60795b7fdce04bd4e5090 #1469 - lib518: sync error message with lib537 Follow-up to 365322b8bcf9efb6a361473d227b70f2032212ce - lib518, lib537: replace `-Wformat-nonliteral` suppression pragmas by reworking test code. Follow-up to 5b286c250829e06a135a6ba998e80beb7f43a734 #12812 Follow-up to aee4ebe59161d0a5281743f96e7738ad97fe1cd4 #12803 Follow-up to 09230127589eccc7e01c1a7217787ef8e64f3328 #12540 Follow-up to 3829759bd042c03225ae862062560f568ba1a231 #12489 Reviewed-by: Daniel Stenberg Closes #12814 Richard Levitte (27 Jan 2024) - cmake: freshen up docs/INSTALL.cmake - Turn docs/INSTALL.cmake into a proper markdown file, docs/INSTALL-CMAKE.md - Move things around to divide the description into configuration, building and installing sections - Mention the more modern cmake options to configure, build and install, but also retain the older variants as fallbacks Closes #12772 Viktor Szakats (27 Jan 2024) - build: delete/replace clang warning pragmas - delete redundant warning suppressions for `-Wformat-nonliteral`. This now relies on `CURL_PRINTF()` and it's theoratically possible that this macro isn't active but the warning is. We're ignoring this as a corner-case here. - replace two pragmas with code changes to avoid the warnings. Follow-up to aee4ebe59161d0a5281743f96e7738ad97fe1cd4 #12803 Follow-up to 09230127589eccc7e01c1a7217787ef8e64f3328 #12540 Follow-up to 3829759bd042c03225ae862062560f568ba1a231 #12489 Reviewed-by: Daniel Stenberg Closes #12812 Daniel Stenberg (27 Jan 2024) - RELEASE-NOTES: synced - http: only act on 101 responses when they are HTTP/1.1 For 101 responses claiming to be any other protocol, bail out. This would previously trigger an assert. Add test 1704 to verify. Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=66184 Closes #12811 Scarlett McAllister (27 Jan 2024) - _VARIABLES.md: add missing 'be' into the sentence Closes #12809 Stefan Eissing (27 Jan 2024) - mqtt, remove remaining use of data->state.buffer Closes #12799 Daniel Stenberg (27 Jan 2024) - x509asn1: switch from malloc to dynbuf Closes #12808 - x509asn1: make utf8asn1str() use dynbuf instead of malloc + memcpy Closes #12808 - x509asn1: reduce malloc in Curl_extract_certinfo Using dynbuf Closes #12808 Jay Satiro (27 Jan 2024) - THANKS: add Alexander Bartel and Brennan Kinney They reported and investigated #10259 which was fixed by 7b2d98df. Ref: https://github.com/curl/curl/issues/10259 Daniel Stenberg (26 Jan 2024) - krb5: add prototype to silence clang warnings on mvsnprintf() "error: format string is not a string literal" Follow-up to 09230127589eccc7 which made the warning appear Assisted-by: Viktor Szakats Closes #12803 - x509asn1: remove code for WANT_VERIFYHOST No code ever sets this anymore since we dropped gskit Follow-up to 78d6232f1f326b9ab4d Closes #12804 - socks: reduce the buffer size to 600 (from 8K) This is malloc'ed memory and it does not more. Test 742 helps us verify this. Closes #12789 Stefan Eissing (26 Jan 2024) - file+ftp: use stack buffers instead of data->state.buffer Closes #12789 - vtls: receive max buffer - do not only receive one TLS record, but try to fill the passed buffer - consider <4K remaning space is "filled". Closes #12801 Daniel Stenberg (26 Jan 2024) - docs: do not start lines/sentences with So, But nor And Closes #12802 - docs: remove spurious ampersands from markdown They were leftovers from the nroff conversion. Follow-up to eefcc1bda4bccd800f5a5 Closes #12800 Patrick Monnerat (26 Jan 2024) - sasl: make login option string override http auth - Use http authentication mechanisms as a default, not a preset. Consider http authentication options which are mapped to SASL options as a default (overriding the hardcoded default mask for the protocol) that is ignored if a login option string is given. Prior to this change, if some HTTP auth options were given, sasl mapped http authentication options to sasl ones but merged them with the login options. That caused problems with the cli tool that sets the http login option CURLAUTH_BEARER as a side-effect of --oauth2-bearer, because this flag maps to more than one sasl mechanisms and the latter cannot be cleared individually by the login options string. New test 992 checks this. Fixes https://github.com/curl/curl/issues/10259 Closes https://github.com/curl/curl/pull/12790 Stefan Eissing (26 Jan 2024) - socks: use own buffer instead of data->state.buffer Closes #12788 Daniel Stenberg (26 Jan 2024) - socks: fix generic output string to say SOCKS instead of SOCKS4 ... since it was also logged for SOCKS5. Closes #12797 - test742: test SOCKS5 with max length user, password and hostname Adjusted the socksd server accordingly to allow for configuring that long user name and password. Closes #12797 Stefan Eissing (25 Jan 2024) - ssh: use stack scratch buffer for seeks - instead of data->state.buffer Closes #12794 Daniel Stenberg (25 Jan 2024) - krb5: access the response buffer correctly As the pingpong code no longer uses the download buffer. Folllow-up to c2d973627bab12ab Pointed-out-by: Stefan Eissing Closes #12796 Stefan Eissing (25 Jan 2024) - mqtt: use stack scratch buffer for recv+publish - instead of data->state.buffer Closes #12792 - telnet, use stack scratch buffer for do - instead of data->state.buffer Closes #12793 - http, use stack scratch buffer - instead of data->state.buffer Closes #12791 - ntlm_wb: do not use data->state.buf any longer Closes #12787 - gitignore: the generated `libcurl-symbols.md` Closes #12795 Daniel Stenberg (25 Jan 2024) - tool: fix the listhelp generation command The previous command line to generate the tool_listhelp.c source file broke with 2494b8dd5175cee7. Make 'make listhelp' invoked in src/ generate it. Also update the comment in the file to mention the right procedure. Closes #12786 - http: check for "Host:" case insensitively When checking if the user wants to replace the header, the check should be case insensitive. Adding test 461 to verify Found-by: Dan Fandrich Ref: #12782 Closes #12784 Tatsuhiro Tsujikawa (25 Jan 2024) - configure: add libngtcp2_crypto_boringssl detection If OpenSSL is found to be BoringSSL or AWS-LC, and ngtcp2 is requested, try to detect libngtcp2_crypto_boringssl. Reported-by: ウさん Fixes #12724 Closes #12769 Daniel Stenberg (25 Jan 2024) - http: remove comment reference to a removed solution Follow-up to 58974d25d Closes #12785 Stefan Eissing (25 Jan 2024) - pytest: Scorecard tracking CPU and RSS Closes #12765 Graham Campbell (25 Jan 2024) - GHA: bump ngtcp2, gnutls, mod_h2, quiche - ngtcp2 to v1.2.0 - gnutls to 3.8.3 - mod_h2 to 2.0.26 - quiche to 0.20.0 Closes #12778 Closes #12779 Closes #12780 Closes #12781 Daniel Stenberg (25 Jan 2024) - ftpserver.pl: send 213 SIZE response without spurious newline - pingpong: stop using the download buffer The pingpong logic now uses its own dynbuf for receiving command response data. When the "final" response header for a commanad has been received, that final line is left first in the recvbuf for the protocols to parse at will. If there is additional data behind the final response line, the 'overflow' counter is indicate how many bytes. Closes #12757 - gen.pl: remove bold from .IP used for ## Reported-by: Viktor Szakats Fixes #12776 Closes #12777 Viktor Szakats (24 Jan 2024) - cmake: rework options to enable curl and libcurl docs Rework CMake options for building/using curl tool and libcurl manuals. - rename `ENABLE_MANUAL` to `ENABLE_CURL_MANUAL`, meaning: to build man page and built-in manual for curl tool. - rename `BUILD_DOCS` to `BUILD_LIBCURL_DOCS`, meaning: to build man pages for libcurl. - `BUILD_LIBCURL_DOCS` now works without having to enable `ENABLE_CURL_MANUAL` too. - drop support for existing CMake-level `USE_MANUAL` option to avoid confusion. (It used to work with the effect of current `ENABLE_CURL_MANUAL`, but only by accident.) Assisted-by: Richard Levitte Ref: #12771 Closes #12773 Daniel Stenberg (24 Jan 2024) - urlapi: remove assert This assert triggers wrongly when CURLU_GUESS_SCHEME and CURLU_NO_AUTHORITY are both set and the URL is a single path. I think this assert has played out its role. It was introduced in a rather big refactor. Follow-up to 4cfa5bcc9a Reported-by: promptfuzz_ on hackerone Closes #12775 Patrick Monnerat (24 Jan 2024) - tests: avoid int/size_t conversion size/sign warnings Closes #12768 Daniel Stenberg (24 Jan 2024) - GHA: add a job scanning for "bad words" in markdown This means words, phrases or things we have decided not to use - words that are spelled right according to the dictionary but we want to avoid. In the name of consistency and better documentation. Closes #12764 Viktor Szakats (23 Jan 2024) - cmake: speed up curldown processing, enable by default - cmake: enable `BUILD_DOCS` by default (this controls converting and installing `.3` files from `.md` sources) - cmake: speed up generating `.3` files by using a single command per directory, instead of a single command per file. This reduces external commands by about a thousand. (There remains some CMake logic kicking in resulting in 500 -one per file- external `-E touch_nocreate` calls.) - cd2nroff: add ability to process multiple input files. - cd2nroff: add `-k` option to use the source filename to form the output filename. (instead of the default in-file `Title:` line.) Follow-up to 3f08d80b2244524646ce86915c585509ac54fb4c Follow-up to ea0b575dab86a3c44dd1d547dc500276266aa382 #12753 Follow-up to eefcc1bda4bccd800f5a56a0fe17a2f44a96e88b #12730 Closes #12762 Richard Levitte (23 Jan 2024) - docs: install curl.1 with cmake as well Closes #12759 Daniel Stenberg (23 Jan 2024) - osslq: remove the TLS library from the version output Since we only support using a single TLS library at any one time, we know that the TLS library for QUIC is the same that is also shown for regular TLS. Fixes #12763 Reported-by: Viktor Szakats Closes #12767 Stefan Eissing (23 Jan 2024) - CI: remove unnecessary OpenSSL 3 option `enable-tls1_3` .. and switch OpenSSL 3 libdir from lib64 to lib for consistency. Closes https://github.com/curl/curl/pull/12758 - GHA: bump nghttp2 version to v1.59.0 - Switch to v1.59.0 for GHA CI jobs that use a specific nghttp2-version. Closes https://github.com/curl/curl/pull/12766 Daniel Stenberg (23 Jan 2024) - RELEASE-NOTES: synced - docs/cmdline: change to .md for cmdline docs - switch all invidual files documenting command line options into .md, as the documentation is now markdown-looking. - made the parser treat 4-space indents as quotes - switch to building the curl.1 manpage using the "mainpage.idx" file, which lists the files to include to generate it, instead of using the previous page-footer/headers. Also, those files are now also .md ones, using the same format. I gave them underscore prefixes to make them sort separately: _NAME.md, _SYNOPSIS.md, _DESCRIPTION.md, _URL.md, _GLOBBING.md, _VARIABLES.md, _OUTPUT.md, _PROTOCOLS.md, _PROGRESS.md, _VERSION.md, _OPTIONS.md, _FILES.md, _ENVIRONMENT.md, _PROXYPREFIX.md, _EXITCODES.md, _BUGS.md, _AUTHORS.md, _WWW.md, _SEEALSO.md - updated test cases accordingly Closes #12751 dependabot[bot] (23 Jan 2024) - CI: bump actions/cache from 3 to 4 Bumps [actions/cache](https://github.com/actions/cache) from 3 to 4. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Closes #12756 Daniel Stenberg (23 Jan 2024) - openssl: when verifystatus fails, remove session id from cache To prevent that it gets used in a subsequent transfer that skips the verifystatus check since that check can't be done when the session id is reused. Reported-by: Hiroki Kurosawa Closes #12760 Viktor Szakats (23 Jan 2024) - cmake: add option to disable building docs Richard Levitte (23 Jan 2024) - cmake: use curldown to build man pages This throws away the previous HTML and PDF producers, to mimic what Makefile.am does as faithfully as possible. Closes #12753 Daniel Stenberg (23 Jan 2024) - mksymbolsmanpage.pl: provide references to where the symbol is used - docs: introduce "curldown" for libcurl man page format curldown is this new file format for libcurl man pages. It is markdown inspired with differences: - Each file has a set of leading headers with meta-data - Supports a small subset of markdown - Uses .md file extensions for editors/IDE/GitHub to treat them nicely - Generates man pages very similar to the previous ones - Generates man pages that still convert nicely to HTML on the website - Detects and highlights mentions of curl symbols automatically (when their man page section is specified) tools: - cd2nroff: converts from curldown to nroff man page - nroff2cd: convert an (old) nroff man page to curldown - cdall: convert many nroff pages to curldown versions - cd2cd: verifies and updates a curldown to latest curldown This setup generates .3 versions of all the curldown versions at build time. CI: Since the documentation is now technically markdown in the eyes of many things, the CI runs many more tests and checks on this documentation, including proselint, link checkers and tests that make sure we capitalize the first letter after a period... Closes #12730 Viktor Szakats (22 Jan 2024) - libssh2: use `libssh2_session_callback_set2()` with v1.11.1 To avoid a local hack to pass function pointers and to avoid deprecation warnings when building with libssh2 v1.11.1 or newer: ``` lib/vssh/libssh2.c:3324:5: warning: 'libssh2_session_callback_set' is depreca ted: since libssh2 1.11.1. Use libssh2_session_callback_set2() [-Wdeprecated- declarations] lib/vssh/libssh2.c:3326:5: warning: 'libssh2_session_callback_set' is depreca ted: since libssh2 1.11.1. Use libssh2_session_callback_set2() [-Wdeprecated- declarations] ``` Ref: https://github.com/curl/curl-for-win/actions/runs/7609484879/job/2072082 1100#step:3:4982 Ref: https://github.com/libssh2/libssh2/pull/1285 Ref: https://github.com/libssh2/libssh2/commit/c0f69548be902147ce014ffa40b8db 3cf1d4b0b4 Reviewed-by: Daniel Stenberg Closes #12754 Daniel Stenberg (22 Jan 2024) - transfer: make the select_bits_paused condition check both directions If there is activity in a direction that is not paused, return false. Reported-by: Sergey Bronnikov Bug: https://curl.se/mail/lib-2024-01/0049.html Closes #12740 Stefan Eissing (22 Jan 2024) - http3: initial support for OpenSSL 3.2 QUIC stack - HTTP/3 for curl using OpenSSL's own QUIC stack together with nghttp3 - configure with `--with-openssl-quic` to enable curl to build this. This requires the nghttp3 library - implementation with the following restrictions: * macOS has to use an unconnected UDP socket due to an issue in OpenSSL's datagram implementation See https://github.com/openssl/openssl/issues/23251 This makes connections to non-reponsive servers hang. * GET requests will send the indicator that they have no body in a separate QUIC packet. This may result in processing delays or Transfer-Encodings on proxied requests * uploads that encounter blocks will use 100% cpu as detection of these flow control issue is not working (we have not figured out to pry that from OpenSSL). Closes #12734 Viktor Szakats (22 Jan 2024) - cmake: fix `ENABLE_MANUAL` option Fix the `ENABLE_MANUAL` option. Set it to default to `OFF`. Before this patch `ENABLE_MANUAL=ON` was a no-op, even though it was the option designed to enable building and using the built-in curl manual. (`USE_MANUAL=ON` option worked for this instead, by accident). Ref: https://github.com/curl/curl/pull/12730#issuecomment-1902572409 Closes #12749 Mohammadreza Hendiani (19 Jan 2024) - TODO: update broken link to ratelimit-headers draft Closes #12741 Daniel Stenberg (19 Jan 2024) - cmake: when USE_MANUAL=YES, build the curl.1 man page Fixes KNOWN_BUG 15.4 Closes #12742 - cmdline-opts/write-out.d: remove spurious double quotes Stefan Eissing (19 Jan 2024) - rtsp: Convert assertion into debug log Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=65934 - write excess bytes to the client where the standard excess bytes checks will report any wrongness and fail the transfer Fixes #12738 Closes #12739 Daniel Stenberg (19 Jan 2024) - headers: remove assert from Curl_headers_push The fuzzer managed to reach the function without a terminating CR or LF so let's handle it normally. While there, remove the goto. Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=65839 Closes #12721 - curl_easy_getinfo.3: remove the wrong time value count It said "six" time values but they are eight by now. Remove the mention of the amount. Closes #12727 Viktor Szakats (18 Jan 2024) - mbedtls: fix `-Wnull-dereference` and `-Wredundant-decls` - Silence warning in mbedTLS v3.5.1 public headers: ``` ./mbedtls/_x64-linux-musl/usr/include/psa/crypto_extra.h:489:14: warning: r edundant redeclaration of 'psa_set_key_domain_parameters' [-Wredundant-decls] ./mbedtls/_x64-linux-musl/usr/include/psa/crypto_struct.h:354:14: note: pre vious declaration of 'psa_set_key_domain_parameters' was here ``` Ref: https://github.com/libssh2/libssh2/commit/ecec68a2c13a9c63fe8c2dc457ae 785a513e157c Ref: https://github.com/libssh2/libssh2/pull/1226 - Fix compiler warnings seen with gcc 9.2.0 + cmake unity: ``` ./curl/lib/vtls/mbedtls.c: In function 'mbedtls_bio_cf_read': ./curl/lib/vtls/mbedtls.c:189:11: warning: null pointer dereference [-Wnull -dereference] 189 | nread = Curl_conn_cf_recv(cf->next, data, (char *)buf, blen, &res ult); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~ ./curl/lib/vtls/mbedtls.c: In function 'mbedtls_bio_cf_write': ./curl/lib/vtls/mbedtls.c:168:14: warning: null pointer dereference [-Wnull -dereference] 168 | nwritten = Curl_conn_cf_send(cf->next, data, (char *)buf, blen, & result); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~ ``` - delete stray `#else`. Closes #12720 Daniel Stenberg (17 Jan 2024) - docs: cleanup nroff format use - remove use of .BI for code snippet - stop using .br, just do a blank line - remove use of .PP - remove use for .sp - remove backslash in .IP - use .IP instead of .TP Closes #12731 Stefan Eissing (17 Jan 2024) - test2307: fix expected failure code after ws refactoring Fixes #12722 Closes #12728 Jay Satiro (17 Jan 2024) - cf-socket: show errno in tcpkeepalive error messages - If the socket keepalive options (TCP_KEEPIDLE, etc) cannot be set then show the errno in the verbose error messages. Ref: https://github.com/curl/curl/discussions/12715#discussioncomment-8151652 Closes https://github.com/curl/curl/pull/12726 - tool_getparam: stop supporting `@filename` style for --cookie The `@filename` style was never documented for --cookie but prior to this change curl would accept it anyway and always treat a @ prefixed string as a filename. That's a problem if the string also contains a = sign because then it is documented to be interpreted as a cookie string and not a filename. Example: `--cookie @foo=bar` Before: Interpreted as load cookies from filename foo=bar. After: Interpreted as cookie `@foo=bar` (name `@foo` and value `bar`). Other curl options with a data/filename option-value use the `@filename` to distinguish filenames which is probably how this happened. The --cookie option has never been documented that way. Ref: https://curl.se/docs/manpage.html#-b Closes https://github.com/curl/curl/pull/12645 Stefan Eissing (16 Jan 2024) - websockets: refactor decode chain - use client writer stack for decoding frames - move websocket protocol handler to ws.c Closes #12713 - websockets: check for negative payload lengths - in en- and decoding, check the websocket frame payload lengths for negative values (from curl_off_t) and error the operation in that case - add test 2307 to verify Closes #12707 Daniel Stenberg (16 Jan 2024) - docs: mention env vars not used by schannel Ref: #12704 Co-authored-by: Jay Satiro Closes #12711 - tool_operate: make --remove-on-error only remove "real" files Reported-by: Harry Sintonen Assisted-by: Dan Fandrich Closes #12710 Jay Wu (16 Jan 2024) - url: don't set default CA paths for Secure Transport backend As the default for this backend is the native CA store. Closes #12704 Lin Sun (16 Jan 2024) - asyn-ares: with modern c-ares, use its default timeout Closes #12703 Daniel Stenberg (15 Jan 2024) - tool_operate: stop setting the file comment on Amiga - the URL is capped at 80 cols, which ruins it if longer - it does not strip off URL credentials - it is done unconditonally, not on --xattr - we don't have Amiga in the CI which makes fixing it blindly fragile Someone who builds and tests on Amiga can add it back correctly in a future if there is a desire. Reported-by: Harry Sintonen Closes #12709 Stefan Eissing (15 Jan 2024) - rtsp: deal with borked server responses - enforce a response body length of 0, if the response has no Content-lenght. This is according to the RTSP spec. - excess bytes in a response body are forwarded to the client writers which will report and fail the transfer Follow-up to d7b6ce6 Fixes #12701 Closes #12706 Daniel Stenberg (14 Jan 2024) - version: show only the libpsl version, not its dependencies The libpsl version output otherwise also includes version number for its dependencies, like IDN lib, but since libcurl does not use libpsl's IDN functionality those components are not important. Ref: https://github.com/curl/curl-for-win/issues/63 Closes #12700 Brad Harder (14 Jan 2024) - curl.h: CURLOPT_DNS_SERVERS is only available with c-ares Closes #12695 Daniel Stenberg (14 Jan 2024) - cmdline-opts/gen.pl: error on initital blank line After the "---" separator, there should be no blank line and this script now errors out if one is detected. Ref: #12696 Closes #12698 - cf-h1-proxy: no CURLOPT_USERAGENT in CONNECT with hyper Follow-up to 693cd1679361828a which was incomplete Ref #12680 Closes #12697 - curl_multi_fdset.3: remove mention of null pointer support ... since this funtion has not supported null pointer fd_set arguments since at least 2006. (That's when I stopped my git blame journey) Fixes #12691 Reported-by: sfan5 on github Closes #12692 Mark Huang (14 Jan 2024) - docs/cmdline: remove unnecessary line breaks Closes #12696 Daniel Stenberg (14 Jan 2024) - transfer: remove warning: Value stored to 'blen' is never read Detected by scan-build Follow-up from 1cd2f0072f Closes #12693 Stefan Eissing (13 Jan 2024) - lib: replace readwrite with write_resp This clarifies the handling of server responses by folding the code for the complicated protocols into their protocol handlers. This concerns mainly HTTP and its bastard sibling RTSP. The terms "read" and "write" are often used without clear context if they refer to the connect or the client/application side of a transfer. This PR uses "read/write" for operations on the client side and "send/receive" for the connection, e.g. server side. If this is considered useful, we can revisit renaming of further methods in another PR. Curl's protocol handler `readwrite()` method been changed: ```diff - CURLcode (*readwrite)(struct Curl_easy *data, struct connectdata *conn, - const char *buf, size_t blen, - size_t *pconsumed, bool *readmore); + CURLcode (*write_resp)(struct Curl_easy *data, const char *buf, size_t ble n, + bool is_eos, bool *done); ``` The name was changed to clarify that this writes reponse data to the client side. The parameter changes are: * `conn` removed as it always operates on `data->conn` * `pconsumed` removed as the method needs to handle all data on success * `readmore` removed as no longer necessary * `is_eos` as indicator that this is the last call for the transfer response (end-of-stream). * `done` TRUE on return iff the transfer response is to be treated as finished This change affects many files only because of updated comments in handlers that provide no implementation. The real change is that the HTTP protocol handlers now provide an implementation. The HTTP protocol handlers `write_resp()` implementation will get passed **all** raw data of a server response for the transfer. The HTTP/1.x formatted status and headers, as well as the undecoded response body. `Curl_http_write_resp_hds()` is used internally to parse the response headers and pass them on. This method is public as the RTSP protocol handler also uses it. HTTP/1.1 "chunked" transport encoding is now part of the general *content encoding* writer stack, just like other encodings. A new flag `CLIENTWRITE_EOS` was added for the last client write. This allows writers to verify that they are in a valid end state. The chunked decoder will check if it indeed has seen the last chunk. The general response handling in `transfer.c:466` happens in function `readwrite_data()`. This mainly operates now like: ``` static CURLcode readwrite_data(data, ...) { do { Curl_xfer_recv_resp(data, buf) ... Curl_xfer_write_resp(data, buf) ... } while(interested); ... } ``` All the response data handling is implemented in `Curl_xfer_write_resp()`. It calls the protocol handler's `write_resp()` implementation if available, or does the default behaviour. All raw response data needs to pass through this function. Which also means that anyone in possession of such data may call `Curl_xfer_write_resp()`. Closes #12480 Daniel Stenberg (13 Jan 2024) - RELEASE-NOTES: synced - TODO: TFTP doesn't convert LF to CRLF for mode=netascii Closes #12655 Closes #12690 - gen: do italics/bold for a range of letters, not just single word Previously it would match only on a sequence of non-space, which made it miss to highlight for example "public suffix list". Updated the recent cookie.d edit from 5da57193b732 to use bold instead of italics. Closes #12689 - docs: describe and highlight super cookies Reported-by: Yadhu Krishna M Closes #12687 - configure: when enabling QUIC, check that TLS supports QUIC Most importantly perhaps is when using OpenSSL that the used build/flavor has the QUIC API: the vanilla OpenSSL does not, only BoringSSL, libressl, AWS-LC and quictls do. Ref: https://github.com/curl/curl/commit/5d044ad9480a9f556f4b6a252d7533b1ba7f e57e#r136780413 Closes #12683 Stefan Eissing (11 Jan 2024) - vquic: extract TLS setup into own source - separate ngtcp2 specific parts out - provide callback during init to allow ngtcp2 to apply its defaults Closes #12678 Sergey Markelov (11 Jan 2024) - multi: remove total timer reset in file_do() while fetching file:// The total timer is properly reset in MSTATE_INIT. MSTATE_CONNECT starts with resetting the timer that is a start point for further multi states. If file://, MSTATE_DO calls file_do() that should not reset the total timer. Otherwise, the total time is always less than the pre-transfer and the start transfer times. Closes #12682 Daniel Stenberg (11 Jan 2024) - http_proxy: a blank CURLOPT_USERAGENT should not be used in CONNECT Extended test 80 to verify this. Reported-by: Stefan Eissing Fixes #12680 Closes #12681 - sectransp: do verify_cert without memdup for blobs Since the information is then already stored in memory, this can avoid an extra set of malloc + free calls. Closes #12679 - hsts: remove assert for zero length domain A zero length domain can happen if the HSTS parser is given invalid input data which is not unheard of and is done by the fuzzer. Follow-up from cfe7902111ae547873 Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=65661 Closes #12676 - headers: make sure the trailing newline is not stored extended test1940 to verify blank header fields too Bug: https://curl.se/mail/lib-2024-01/0019.html Reported-by: Dmitry Karpov Closes #12675 - curl_easy_header.3: tiny language fix Closes #12672 - examples/range.c: add Closes #12671 - examples/netrc.c: add Closes #12671 - examples/ipv6.c: new example showing IPv6-only internet transfer Closes #12671 - examples/address-scope.c: renamed from ipv6.c It shows address scope use really Closes #12671 Stefan Eissing (9 Jan 2024) - multi: pollset adjust, init with FIRSTSOCKET during connect - `conn->sockfd` is set by `Curl_setup_transfer()`, but that is called *after* the connection has been established - use `conn->sock[FIRSTSOCKET]` instead Follow-up to a0f94800d507de Closes #12664 Daniel Stenberg (9 Jan 2024) - WEBSOCKET.md: remove dead link - CI: spellcheck/appveyor: invoke configure --without-libpsl Follow-up to 2998874bb61ac6 - cmdline/docs/*.d: switch to using ## instead of .IP To make the editing easier. To write and to read. Closes #12667 - gen.pl: support ## for doing .IP in table-like lists Warn on use of .RS/.IP/.RE Closes #12667 Jay Satiro (9 Jan 2024) - cookie.d: Document use of empty string to enable cookie engine - Explain that --cookie "" can be used to enable the cookie engine without reading any initial cookies. As is documented in CURLOPT_COOKIEFILE. Ref: https://curl.se/libcurl/c/CURLOPT_COOKIEFILE.html Bug: https://github.com/curl/curl/issues/12643#issuecomment-1879844420 Reported-by: janko-js@users.noreply.github.com Closes https://github.com/curl/curl/pull/12646 Daniel Stenberg (9 Jan 2024) - setopt: use memdup0 when cloning COPYPOSTFIELDS Closes #12651 - telnet: use dynbuf instad of malloc for escape buffer Previously, send_telnet_data() would malloc + free a buffer every time for escaping IAC codes. Now, it reuses a dynbuf for this purpose. Closes #12652 - CI: install libpsl or configure --without-libpsl in builds As a follow-up to the stricted libpsl check in configure - configure: make libpsl detection failure cause error To force users to explictily disable it if they really don't want it used and make it harder to accidentally miss it. --without-libpsl is the option to use if PSL is not wanted. Closes #12661 - RELEASE-NOTES: synced - pop3: replace calloc + memcpy with memdup0 ... and make sure to return error on out of memory. Closes #12650 - lib: add debug log outputs for CURLE_BAD_FUNCTION_ARGUMENT Closes #12658 - mime: use memdup0 instead of malloc + memcpy Closes #12649 - tool_getparam: move the --rate logic into set_rate() - tool_getparam: switch to an enum for every option To make the big switch much easier to read/understand and to make it easier to add new options. - tool_getparam: build post data using dynbuf (more) - tool_getparam: replace malloc + copy by dynbuf for --data - tool_getparam: make data_urlencode avoid direct malloc use aprintf() instead - tool_getparam: move the --url-query logic into url_query() This function is not doing post at all so it was always weirdly placed. - tool_getparam: move the --data logic into set_data() - tool_getparam: unify the cmdline switch() into a single one - easier to follow, easier to modify, easier to extend, possibly slightly faster - each case now has the long option as a comment - tool_getparam: bsearch cmdline options - the option names are now alpha sorted and lookup is a lot faster - use case sensitive matching. It was previously case insensitive, but that was not documented nor tested. - remove "partial match" feature. It was not documented, not tested and was always fragile as existing use could break when we add a new option - lookup short options via a table Closes #12631 Gabe (8 Jan 2024) - COPYING: update copyright year Closes #12654 Stefan Eissing (8 Jan 2024) - url: init conn->sockfd and writesockfd to CURL_SOCKET_BAD Also add more tracing to test 19 Follow-up to a0f9480 Fixes #12657 Closes #12659 Daniel Stenberg (8 Jan 2024) - connect: remove margin from eyeballer alloc Presumably leftovers from debugging Closes #12647 - ftp: only consider entry path if it has a length Follow-up from 8edcfedc1a144f438bd1cdf814a0016cb Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=65631 Avoids a NULL pointer deref. Closes #12648 Stefan Eissing (7 Jan 2024) - transfer: adjust_pollset improvements - let `multi_getsock()` initialize the pollset in what the transfer state requires in regards to SEND/RECV - change connection filters `adjust_pollset()` implementation to react on the presence of POLLIN/-OUT in the pollset and no longer check CURL_WANT_SEND/CURL_WANT_RECV - cf-socket will no longer add POLLIN on its own - http2 and http/3 filters will only do adjustments if the passed pollset wants to POLLIN/OUT for the transfer on the socket. This is similar to the HTTP/2 proxy filter and works in stacked filters. Closes #12640 Daniel Stenberg (6 Jan 2024) - ftp: use memdup0 to store the OS from a SYST 215 response avoid malloc + direct buffer fiddle Closes #12639 - ftp: use dynbuf to store entrypath avoid direct malloc Closes #12638 Lealem Amedie (6 Jan 2024) - wolfssl: load certificate *chain* for PEM client certs Closes #12634 Stefan Eissing (4 Jan 2024) - http: adjust_pollset fix do not add a socket for POLLIN when the transfer does not want to send (for example is paused). Follow-up to 47f5b1a Reported-by: bubbleguuum on github Fixes #12632 Closes #12633 Daniel Stenberg (3 Jan 2024) - tool: make parser reject blank arguments if not supported Already in the getstr() function that clones the input argument. Closes #12620 dependabot[bot] (3 Jan 2024) - build(deps): bump github/codeql-action from 2 to 3 Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2 to 3. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/v2...v3) --- updated-dependencies: - dependency-name: github/codeql-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Closes #12625 - build(deps): bump actions/checkout from 3 to 4 Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Closes #12624 - build(deps): bump actions/upload-artifact from 3 to 4 Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) f rom 3 to 4. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Closes #12627 - build(deps): bump actions/download-artifact from 3 to 4 Bumps [actions/download-artifact](https://github.com/actions/download-artifac t) from 3 to 4. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Closes #12626 Stefan Eissing (3 Jan 2024) - http3/quiche: fix result code on a stream reset - fixes pytest failures in test 07_22 - aligns CURLcode values on stream reset with ngtcp2 Closes #12629 Daniel Stenberg (2 Jan 2024) - setopt: clear mimepost when formp is freed A precaution to avoid a possibly dangling pointer left behind. Reported-by: Thomas Ferguson Fixes #12608 Closes #12621 Andy Alt (2 Jan 2024) - CI: Add dependabot.yml This will cause dependabot to open a PR when various actions are updated, provided that the action maintainer has issued a release. Closes #12623 Gisle Vanem (2 Jan 2024) - content_encoding: change return code to typedef'ed enum ... to work around a clang ubsan warning. Fixes #12618 Closes #12622 Daniel Stenberg (2 Jan 2024) - tool: prepend output_dir in header callback When Content-Disposition parsing is used and an output dir is prepended, make sure to store that new file name correctly so that it can be used for setting the file timestamp when --remote-time is used. Extended test 3012 to verify. Co-Authored-by: Jay Satiro Reported-by: hgdagon on github Fixes #12614 Closes #12617 - test1254: fix typo in name plus shorten it - RELEASE-NOTES: synced Viktor Szakats (2 Jan 2024) - schannel: fix `-Warith-conversion` gcc 13 warning ``` lib/vtls/schannel.c:1201:22: warning: conversion to 'unsigned int' from 'int' may change the sign of the result [-Warith-conversion] 1201 | *extension_len = *list_len + | ^ ``` Closes #12616 - asyn-thread: silence `-Wcast-align` warning for Windows Seen with llvm/clang 17: ``` lib/asyn-thread.c:310:5: warning: cast from 'PCHAR' (aka 'char *') to 'struct thread_sync_data *' increases required alignment from 1 to 8 [-Wcast-align] 310 | CONTAINING_RECORD(overlapped, struct thread_sync_data, w8.overlap ped); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~ .../llvm-mingw/aarch64-w64-mingw32/include/winnt.h:717:48: note: expanded fro m macro 'CONTAINING_RECORD' 717 | #define CONTAINING_RECORD(address,type,field) ((type *)((PCHAR)(addre ss) - (ULONG_PTR)(&((type *)0)->field))) | ^~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` Follow-up to a6bbc87f9e9ffb46a1801dfb983e7534825ed56b #12482 Ref: https://github.com/curl/curl/pull/12482#issuecomment-1873017261 Closes #12615 Daniel Stenberg (2 Jan 2024) - tool_listhelp: regenerate after recent .d updates Makes it survive test 1478 Closes #12612 - test1478: verify src/tool_listhelp.c Verify that the source file on disk is identical to the output of gen.pl listhelp, as otherwise they are out of sync and need attention. Closes #12612 - testutil: make runtests support %include Using this instruction, a test case can include the contents of a file into the test during the preprocessing. Closes #12612 - runtests: for mode="text" on , fix newlines on both parts Closes #12612 Jay Satiro (2 Jan 2024) - quiche: return CURLE_HTTP3 on send to invalid stream Prior to this change if a send failed on a stream in an invalid state (according to quiche) and not marked as closed (according to libcurl) then the send function would return CURLE_SEND_ERROR. We already have similar code for ngtcp2 to return CURLE_HTTP3 in this case. Caught by test test_07_upload.py: test_07_22_upload_parallel_fail. Fixes https://github.com/curl/curl/issues/12590 Closes https://github.com/curl/curl/pull/12597 Daniel Stenberg (1 Jan 2024) - cmdline-opts: update availability for the *-ca-native options Closes #12613 Patrick Monnerat (31 Dec 2023) - openldap: fix STARTTLS It was not working anymore since introduction of connection filters. Also do not attempt to recover from a failing TLS negotiation with CURLUSESSL_TRY. Closes #12610 Daniel Stenberg (31 Dec 2023) - haproxy-clientip.d: document the arg The arg keyword was missing and therefore not present in the man page. Closes #12611 annalee (29 Dec 2023) - configure: fix no default int compile error in ipv6 detection Closes #12607 Dan Fandrich (28 Dec 2023) - CI: Fix use of any-glob-to-all-files in the labeler Despite its name, this atom acts like one-glob-to-all-files and a different syntax with braces must be used to get any-glob-to-all-files semantics. Unfortunately, this makes the file completely unreadable. Ref: https://github.com/actions/labeler/issues/731 Daniel Stenberg (29 Dec 2023) - CURLOPT_AUTOREFERER.3: mention CURLINFO_REFERER - CURLINFO_REFERER.3: clarify that it is the *request* header That libcurl itself sent in the most recent request Closes #12605 Jay Satiro (28 Dec 2023) - system_win32: fix a function pointer assignment warning - Use CURLX_FUNCTION_CAST to suppress a function pointer assignment warning. a6bbc87f added lookups of some Windows API functions and then cast them like `*(FARPROC*)&Curl_funcname = address`. Some versions of gcc warn about that as breaking strict-aliasing rules so this PR changes those assignments to use CURLX_FUNCTION_CAST. Bug: https://github.com/curl/curl/pull/12581#issuecomment-1869804317 Reported-by: Marcel Raad Closes https://github.com/curl/curl/pull/12602 - verify-examples.pl: fail verification on unescaped backslash - Check that all backslashes in EXAMPLE are properly escaped. eg manpage must always use `\\n` never `\n`. This is because the manpage requires we always double blackslash to show a single backslash. Prior to this change an erroneous single backslash would pass through and compile even though it would not show correctly in the manpage. Co-authored-by: Daniel Stenberg Ref: https://github.com/curl/curl/pull/12588 Closes https://github.com/curl/curl/pull/12589 - vtls: fix missing multissl version info - Fix erroneous buffer copy logic from ff74cef5. Prior to this change the MultiSSL version info returned to the user was empty. Closes https://github.com/curl/curl/pull/12599 Daniel Stenberg (27 Dec 2023) - KNOWN_BUGS: [RTSP] Some methods do not support response bodies Closes #12414 Patrick Monnerat (27 Dec 2023) - openldap: fix an LDAP crash Reported-by: Ozan Cansel Fixes #12593 Closes #12600 Daniel Stenberg (27 Dec 2023) - getinfo: CURLINFO_QUEUE_TIME_T Returns the time, in microseconds, during which this transfer was held in a waiting queue before it started "for real". A transfer might be put in a queue if after getting started, it cannot create a new connection etc due to set conditions and limits imposed by the application. Ref: #12293 Closes #12368 - RELEASE-NOTES: synced Jay Satiro (26 Dec 2023) - examples/sendrecv: fix comment line length Caught by checksrc. Haydar Alaidrus (23 Dec 2023) - CURLOPT_POSTFIELDS.3: fix incorrect C string escape in example - Escape inner quotes with two backslashes. Two backslashes escapes the backslash for the man page and will show as a single backslash. eg: "{\\"name\\": \\"daniel\\"}" shows as "{\"name\": \"daniel\"}". Closes https://github.com/curl/curl/pull/12588 Viktor Szakats (23 Dec 2023) - appveyor: tidy-ups - replace two remaining backslashes with forward slashes. - tidy up the way we form and pass `TFLAGS`. Follow-up to 2d4d0c1fd32f5cc3f946c407c8eccd5477b287df #12572 Closes #12582 Stefan Eissing (22 Dec 2023) - transfer: fix upload rate limiting, add test cases - add test cases for rate limiting uploads for all http versions - fix transfer loop handling of limits. Signal a re-receive attempt only on exhausting maxloops without an EAGAIN - fix `data->state.selectbits` forcing re-receive to also set re-sending when transfer is doing this. Reported-by: Karthikdasari0423 on github Fixes #12559 Closes #12586 Daniel Stenberg (22 Dec 2023) - mbedtls: free the entropy when threaded The entropy_free was never done for threaded builds, causing a small (fixed) memory leak. Reported-by: RevaliQaQ on github Fixes #12584 Closes #12585 Stefan Eissing (22 Dec 2023) - http2: improved on_stream_close/data_done handling - there seems to be a code path that cleans up easy handles without triggering DONE or DETACH events to the connection filters. This would explain wh nghttp2 still holds stream user data - add GOOD check to easy handle used in on_close_callback to prevent crashes, ASSERTs in debug builds. - NULL the stream user data early before submitting RST - add checks in on_stream_close() to identify UNGOOD easy handles Reported-by: Hans-Christian Egtvedt Fixes #10936 Closes #12562 Daniel Stenberg (22 Dec 2023) - mprintf: overhaul and bugfixes In a test case using lots of snprintf() calls using many commonly used %-codes per call, this version is around 30% faster than previous version. It also fixes the #12561 bug which made it not behave correctly when given unknown %-sequences. Fixing that flaw required a different take on the problem, which resulted in the new two-arrays model. lib557: extended - Verify the #12561 fix and test more printf features unit1398: fix test: It used a $ only for one argument, which is not supported. Fixes #12561 Closes #12563 Viktor Szakats (21 Dec 2023) - appveyor: replace PowerShell with bash + parallel autotools PowerShell works (after a steep development curve), but one property of it stuck and kept causing unresolvable usability issues: With `$ErrorActionPreference=Stop`, it does abort on failures, but shows only the first line of the error message. In `Continue` mode, it shows the full error message, but doesn't stop on all errors. Another issue is PowerShell considering any stderr output as if the command failed (this has been improved in 7.2 (2021-Nov), but fixed versions aren't running in CI and will not be for a long time in all test images.) Thus, we're going with bash. Also: - use `-j2` with autotools tests, making them finish 5-15 minutes per job faster. - omit `POSIX_PATH_PREFIX`. - use `WINDIR`. - prefer forward slashes. Follow-up to: 75078a415d9c769419aed4153d3d525a8eba95af #11999 Ref: #12444 Fixes #12560 Closes #12572 Pavel Pavlov (21 Dec 2023) - asyn-thread: use GetAddrInfoExW on >= Windows 8 For doing async DNS resolution instead of starting a thread for each request. Fixes #12481 Closes #12482 Daniel Stenberg (21 Dec 2023) - strerror: repair get_winsock_error() It would try to read longer than the provided string and crash. Follow-up to ff74cef5d4a0cf60106517a1c7384 Reported-by: calvin2021y on github Fixes #12578 Closes #12579 - CURLOPT_SSH_*_KEYFILE: clarify Closes #12554 ivanfywang (21 Dec 2023) - ngtcp2: put h3 at the front of alpn Closes #12576 Daniel Stenberg (21 Dec 2023) - test460: verify a command line using --expand with no argument This verifies the fix for #12565 - tool_getparam: do not try to expand without an argument This would lead to a segfault. Fixes #12565 Reported-by: Geeknik Labs Closes #12575 - RELEASE-NOTES: synced Bumped version to 8.6.0 because of changes - Makefile.am: fix the MSVC project generation It made the vcxproj files not get included in dist tarballs. Regression since 74423b5df4c8117891eb89 (8.5.0) Reported-by: iAroc on github Fixes #12564 Closes #12567 zengwei2000 (21 Dec 2023) - altsvc: free 'as' when returning error Closes #12570 Signed-off-by: zengwei Viktor Szakats (20 Dec 2023) - build: fix `-Wconversion`/`-Wsign-conversion` warnings Fix remaining warnings in examples and tests which are not suppressed by the pragma in `lib/curl_setup.h`. Silence a toolchain issue causing warnings in `FD_SET()` calls with older Cygwin/MSYS2 builds. Likely fixed on 2020-08-03 by: https://cygwin.com/git/?p=newlib-cygwin.git;a=commitdiff;h=5717262b8ecfed0f7f ab63e2c09c78991e36f9dd Follow-up to 2dbe75bd7f3c36837aa06fd87a442bdf3fb7faef #12492 Closes #12557 - build: fix some `-Wsign-conversion`/`-Warith-conversion` warnings - enable `-Wsign-conversion` warnings, but also setting them to not raise errors. - fix `-Warith-conversion` warnings seen in CI. These are triggered by `-Wsign-converion` and causing errors unless explicitly silenced. It makes more sense to fix them, there just a few of them. - fix some `-Wsign-conversion` warnings. - hide `-Wsign-conversion` warnings with a `#pragma`. - add macro `CURL_WARN_SIGN_CONVERSION` to unhide them on a per-build basis. - update a CI job to unhide them with the above macro: https://github.com/curl/curl/actions/workflows/linux.yml -> OpenSSL -O3 Closes #12492 - cmake: tidy-up `OtherTests.cmake` - make more obvious which detection uses which prep steps. - merge and streamline conditions. - these should not alter detection results. Also align log output messages from `Macros.cmake` / `curl_internal_test` with rest of the build. Closes #12551 - appveyor: switch to out-of-tree builds With cmake and autotools. Closes #12550 Daniel Stenberg (19 Dec 2023) - DEPRECATE.md: mention that NTLM_WB no longer works Ref: #12479 Closes #12553 - CURLOPT_SERVER_RESPONSE_TIMEOUT_MS: add Proposed-by: Yifei Kong Ref: https://curl.se/mail/lib-2023-11/0023.html Closes #12369 Viktor Szakats (18 Dec 2023) - build: more `-Wformat` fixes - memdebug: update to not trigger `-Wformat-nonliteral` warnings. - imap: mark `imap_sendf()` with `CURL_PRINTF()`. - tool_msgs: mark static function with `CURL_PRINTF()`. Follow-up to 3829759bd042c03225ae862062560f568ba1a231 #12489 Closes #12540 - windows: delete redundant headers `winsock2.h` pulls in `windows.h`. `ws2tcpip.h` pulls in `winsock2.h`. `winsock2.h` and `ws2tcpip.h` are also pulled by `curl/curl.h`. Keep only those headers that are not already included, or the code under it uses something from that specific header. Closes #12539 - cmake: prefill/cache `HAVE_STRUCT_SOCKADDR_STORAGE` Also add missing include to `OtherTests.cmake`. It didn't cause an issue because the parent already included this earlier by chance. Closes #12537 Daniel Stenberg (18 Dec 2023) - runner.pm: fix perl warning when running tests Use of uninitialized value $runner::gdbthis in numeric eq (==) at runner. pm Follow-up from 3dcf301752a09d9 Closes #12549 - runtests: support -gl. Like -g but for lldb. Follow-up to 63b5748 Invokes the test case via lldb instead of gdb. Since using gdb is such a pain on mac, using lldb is sometimes less quirky. Closes #12547 - curl.h: add CURLE_TOO_LARGE A new error code to be used when an internal field grows too large, like when a dynbuf reaches its maximum. Previously it would return CURLE_OUT_OF_MEMORY for this, which is highly misleading. Ref: #12268 Closes #12269 - CI/circleci: disable MQTT in the HTTP-only build And remove the use of configure options that don't actually exist Closes #12546 Yedaya Katsman (18 Dec 2023) - tests: respect $TMPDIR when creating unix domain sockets When running on termux, where $TMPDIR isn't /tmp, running the tests failed, since the server config tried creating sockets in /tmp, without checking the temp dir config. Use the TMPDIR variable that makes it find the correct directory everywhere [0] [0] https://perldoc.perl.org/File::Temp#tempfile Closes #12545 Viktor Szakats (17 Dec 2023) - ssh: fix namespace of two local macros Avoid using the libssh and libssh2 macro namespaces by prefixing these local macro names with `CURL_`. Follow-up to 413a0fedd02c8c6df1d294534b8c6e306fcca7a2 #12346 Reviewed-by: Daniel Stenberg Closes #12544 - cmake: whitespace tidy-up in `OtherTests.cmake` Closes #12538 Mark Sinkovics (16 Dec 2023) - cmake: fix generation for system name iOS This PR fixes a problem that happens during CMake configuration when the `CMAKE_SYSTEM_NAME` set to `iOS` and not `Darwin`. This value is available (as far as I remember) version 3.14. The final solution (thanks to @vszakats) is to use `APPLE` which contains all the Apple platforms https://cmake.org/cmake/help/latest/variable/APPLE.html. This issue was found when during vcpkg installation. Running command `vcpkg install curl:arm64-ios` and `vcpkg install curl:x64-ios` failed with message: ``` CMake Error: try_run() invoked in cross-compiling mode, please set the follow ing cache variables appropriately: HAVE_H_ERRNO_ASSIGNABLE_EXITCODE (advanced) ``` After this fix, I was able to compile the compile the binary without any issue. In addition to that fix, this PR also contains an simplification to check if the platform is not APPLE. Co-authored-by: Viktor Szakats Closes #12515 Daniel Stenberg (16 Dec 2023) - RELEASE-NOTES: synced Baruch Siach (16 Dec 2023) - gnutls: fix build with --disable-verbose infof() parameters must be defined event with --disable-verbose since commit dac293cfb702 ("lib: apache style infof and trace macros/functions"). Move also 'ptr' definition under !CURL_DISABLE_VERBOSE_STRINGS. Fixes the following build failure: In file included from ../lib/sendf.h:29, from vtls/gtls.c:44: vtls/gtls.c: In function 'Curl_gtls_verifyserver': vtls/gtls.c:841:34: error: 'version' undeclared (first use in this function); did you mean 'session'? 841 | gnutls_protocol_get_name(version), ptr); | ^~~~~~~ Closes #12505 Viktor Szakats (16 Dec 2023) - build: delete unused `HAVE_{GSSHEIMDAL,GSSMIT,HEIMDAL}` Stop setting `HAVE_GSSHEIMDAL`, `HAVE_GSSMIT` and `HAVE_HEIMDAL`. There was no place in the build system or source code that used them. Reviewed-by: Daniel Stenberg Closes #12506 - build: remove redundant `CURL_PULL_*` settings These macros were not propagated to the source code from CMake. autotools set only one of them (`CURL_PULL_SYS_POLL_H`), initially to address an AIX issue [1]. This later broke when introducing `system.h` [2] without the logic it enabled. A subsequent fix [3] re-added the logic, and also enabled it for AIX before its use, directly in `system.h`. [1] 2012-11-23: 665adcd4b7bcdb7deb638cdc499fbe71f8d777f2 [2] 2017-03-29: 9506d01ee50d5908138ebad0fd9fbd39b66bd64d #1373 [3] 2017-08-25: 8a84fcc4b59e8b78d2acc6febf44a43d6bc81b59 #1828 #1833 Reviewed-by: Daniel Stenberg Closes #12502 - system.h: sync mingw `CURL_TYPEOF_CURL_SOCKLEN_T` with other compilers Align mingw with the other Windows compilers and use the `int` type for `CURL_TYPEOF_CURL_SOCKLEN_T` (and thus for `curl_socklent_t`). This makes it unnecessary to make a mingw-specific trick and pull all Windows headers early just for this type definition. This type is specific to Windows, not to the compiler. mingw-w64's Windows header maps it to `int` too. With this we also delete all remaining uses of `CURL_PULL_WS2TCPIP_H`. [ The official solution is to use `socklen_t` for all Windows compilers. In this case we may want to update `curl/curl.h` to pull in Windows headers before `system.h`. ] Reviewed-by: Daniel Stenberg Reviewed-by: Jay Satiro Closes #12501 - windows: simplify detecting and using system headers - autotools, cmake: assume that if we detect Windows, `windows.h`, `winsock2.h` and `ws2tcpip.h` do exist. - lib: fix 3 outlier `#if` conditions to use `USE_WINSOCK` instead of looking for `winsock2.h`. - autotools: merge 3 Windows check methods into one. - move Watt-32 and lwIP socket support to `setup-win32.h` from `config-win32.h`. It opens up using these with all build tools. Also merge logic with Windows Sockets. - fix to assume Windows sockets with the mingw32ce toolchain. Follow-up to: 2748c64d605b19fb419ae56810ad8da36487a2d4 - cmake: delete unused variable `signature_call_conv` since eb33ccd5332435fa50f1758e5debb869c6942b7f. - autotools: simplify `CURL_CHECK_WIN32_LARGEFILE` detection. - examples/externalsocket: fix header order. - cmake/OtherTests.cmake: delete Windows-specific `_source_epilogue` that wasn't used anymore. - cmake/OtherTests.cmake: set `WIN32_LEAN_AND_MEAN` for test `SIZEOF_STRUCT_SOCKADDR_STORAGE`. After this patch curl universally uses `_WIN32` to guard Windows-specific logic. It guards Windows Sockets-specific logic with `USE_WINSOCK` (this might need further work). Reviewed-by: Jay Satiro Closes #12495 - build: enable missing OpenSSF-recommended warnings, with fixes https://best.openssf.org/Compiler-Hardening-Guides/Compiler-Options-Hardening -Guide-for-C-and-C++.html as of 2023-11-29 [1]. Enable new recommended warnings (except `-Wsign-conversion`): - enable `-Wformat=2` for clang (in both cmake and autotools). - add `CURL_PRINTF()` internal attribute and mark functions accepting printf arguments with it. This is a copy of existing `CURL_TEMP_PRINTF()` but using `__printf__` to make it compatible with redefinting the `printf` symbol: https://gcc.gnu.org/onlinedocs/gcc-3.0.4/gcc_5.html#SEC94 - fix `CURL_PRINTF()` and existing `CURL_TEMP_PRINTF()` for mingw-w64 and enable it on this platform. - enable `-Wimplicit-fallthrough`. - enable `-Wtrampolines`. - add `-Wsign-conversion` commented with a FIXME. - cmake: enable `-pedantic-errors` the way we do it with autotools. Follow-up to d5c0351055d5709da8f3e16c91348092fdb481aa #2747 - lib/curl_trc.h: use `CURL_FORMAT()`, this also fixes it to enable format checks. Previously it was always disabled due to the internal `printf` macro. Fix them: - fix bug where an `set_ipv6_v6only()` call was missed in builds with `--disable-verbose` / `CURL_DISABLE_VERBOSE_STRINGS=ON`. - add internal `FALLTHROUGH()` macro. - replace obsolete fall-through comments with `FALLTHROUGH()`. - fix fallthrough markups: Delete redundant ones (showing up as warnings in most cases). Add missing ones. Fix indentation. - silence `-Wformat-nonliteral` warnings with llvm/clang. - fix one `-Wformat-nonliteral` warning. - fix new `-Wformat` and `-Wformat-security` warnings. - fix `CURL_FORMAT_SOCKET_T` value for mingw-w64. Also move its definition to `lib/curl_setup.h` allowing use in `tests/server`. - lib: fix two wrongly passed string arguments in log outputs. Co-authored-by: Jay Satiro - fix new `-Wformat` warnings on mingw-w64. [1] https://github.com/ossf/wg-best-practices-os-developers/blob/56c0fde3895b fc55c8a973ef49a2572c507b2ae1/docs/Compiler-Hardening-Guides/Compiler-Options- Hardening-Guide-for-C-and-C%2B%2B.md Closes #12489 - Makefile.mk: drop Windows support And DLL-support with it. This leaves `Makefile.mk` for MS-DOS and Amiga. We recommend CMake instead. With unity mode it's much faster, and about the same without. Ref: https://github.com/curl/curl/pull/12221#issuecomment-1783761806 Reviewed-by: Daniel Stenberg Closes #12224 Daniel Stenberg (16 Dec 2023) - cmdline-docs: use .IP consistently Remove use of .TP and some .B. The idea is to reduce nroff syntax as much as possible and to use it consistently. Ultimately, we should be able to introduce our own easier-to-use-and-read syntax/formatting and convert on generation time. Closes #12535 Tatsuhiko Miyagawa (16 Dec 2023) - http: fix off-by-one error in request method length check It should allow one more byte. Closes #12534 Daniel Stenberg (15 Dec 2023) - curl: show ipfs and ipns as supported "protocols" They are accepted schemes in URLs passed to curl (the tool, not the library). Also makes curl-config show the same list. Co-Authored-by: Jay Satiro Reported-by: Chara White Bug: https://curl.se/mail/archive-2023-12/0026.html Closes #12508 - Revert "urldata: move async resolver state from easy handle to connectdata" This reverts commit 56a4db2e4e2bcb9a0dcb75b83560a78ef231fcc8 (#12198) We want the c-ares channel to be held in the easy handle, not per connection - for performance. Closes #12524 Viktor Szakats (15 Dec 2023) - openssl: re-match LibreSSL deinit with init Earlier we switched to use modern initialization with LibreSSL v2.7.0 and up, but did not touch deinitialization [1]. Fix it in this patch. Regression from bec0c5bbf34369920598678161d2df8bea0e243b #11611 [1] https://github.com/curl/curl/pull/11611#issuecomment-1668654014 Reported-by: Mike Hommey Reviewed-by: Daniel Stenberg Fixes #12525 Closes #12526 Daniel Stenberg (14 Dec 2023) - libssh: supress warnings without version check Define unconditionally. Follow-up from d21bd2190c46ad7fa Closes #12523 - hostip: return error immediately when Curl_ip2addr() fails Closes #12522 Theo (14 Dec 2023) - libssh: improve the deprecation warning dismissal Previous code was compiler dependant, and dismissed all deprecation warnings indiscriminately. libssh provides a way to disable the deprecation warnings for libssh only, an d naturally this is the preferred way. This commit uses that, to prevent the erroneous hiding of potential, unrelate d deprecation warnings. Fixes #12519 Closes #12520 Daniel Stenberg (14 Dec 2023) - test1474: removed The test was already somewhat flaky and disabled on several platforms, and after 1da640abb688 even more unstable. - readwrite_data: loop less This function is made to loop in order to drain incoming data faster. Completely removing the loop has a measerably negative impact on transfer speeds. Downsides with the looping include - it might call the progress callback much more seldom. Especially if the write callback is slow. - rate limiting becomes less exact - a single transfer might "starve out" other parallel transfers - QUIC timers for other connections can't be maintained correctly The long term fix should be to remove the loop and optimize coming back to avoid the transfer speed penalty. This fix lower the max loop count to reduce the starvation problem, and avoids the loop completely for when rate-limiting is in progress. Ref: #12488 Ref: https://curl.se/mail/lib-2023-12/0012.html Closes #12504 Stefan Eissing (14 Dec 2023) - lib: eliminate `conn->cselect_bits` - use `data->state.dselect_bits` everywhere instead - remove `bool *comeback` parameter as non-zero `data->state.dselect_bits` will indicate that IO is incomplete. Closes #12512 - connect: refactor `Curl_timeleft()` - less local vars, "better" readability - added documentation Closes #12518 Dmitry Karpov (14 Dec 2023) - cookie: avoid fopen with empty file name Closes #12514 Viktor Szakats (13 Dec 2023) - tests/server: delete workaround for old-mingw mingw-w64 1.0 comes with w32api v3.12, thus doesn't need this. Follow-up to 38029101e2d78ba125732b3bab6ec267b80a0e72 #11625 Reviewed-by: Jay Satiro Closes #12510 - cmake: delete obsolete TODOs more [ci skip] - manual completed: 898b012a9bf388590c4be7f526815b5ab74feca1 #1288 - soname completed: 5de6848f104d7cb0017080e31216265ac19d0dde #10023 - bunch of others that are completed - `NTLM_WB_ENABLED` is implemented in a basic form, and now also scheduled for removal, so a TODO at this point isn't useful. And this 'to-check' item: Q: "The cmake build selected to run gcc with -fPIC on my box while the plain configure script did not." A: With CMake, since 2ebc74c36a19a1700af394c16855ce144d9878e3 #11546 and fc9bfb14520712672b4784e8b48256fb29204011 #11627, we explicitly enable PIC for libcurl shared lib. Or when building libcurl for shared and static lib in a single pass. We do this by default for Windows or when enabled by the user via `SHARE_LIB_OBJECT`. Otherwise we don't touch this setting. Meaning the default set by CMake (if any) or the toolchain is used. On Debian Bookworm, this means that PIC is disabled for static libs by default. Some platforms (like macOS), has PIC enabled by default. autotools supports the double-pass mode only, and in that case CMake seems to match PIC behaviour now (as tested on Linux with gcc.) Follow-up to 5d5dfdbd1a6c40bd75e982b66f49e1fa3a7eeae7 #12500 Reviewed-by: Jay Satiro Closes #12509 Stefan Eissing (12 Dec 2023) - CLIENT-WRITERS: design and use documentation Closes #12507 Viktor Szakats (12 Dec 2023) - cmake: delete obsolete TODO items [ci skip] There is always room for improvement, but CMake is up to par now with autotools, so there is no longer a good reason to keep around these inline TODO items. Answering one of questions: Q: "The gcc command line use neither -g nor any -O options. As a developer, I also treasure our configure scripts's --enable-debug option that sets a long range of "picky" compiler options." A: CMake offers the `CMAKE_BUILD_TYPE` variable to control debug info and optimization level. E.g.: - `Release` = `-O3` + no debug info - `MinSizeRel` = `-Os` + no debug info - `Debug` = `-O0` + debug info https://stackoverflow.com/questions/48754619/what-are-cmake-build-type-deb ug-release-relwithdebinfo-and-minsizerel/59314670#59314670 https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#defaul t-and-custom-configurations For picky warnings we have the `PICKY_COMPILER` options, enabled by default. Closes #12500 Stefan Eissing (11 Dec 2023) - CONNECTION-FILTERS: update documentation Closes #12497 Daniel Stenberg (11 Dec 2023) - lib: reduce use of strncpy - bearssl: select cipher without buffer copies - http_aws_sigv4: avoid strncpy, require exact timestamp length - http_aws_sigv4: use memcpy isntead of strncpy - openssl: avoid strncpy calls - schannel: check for 1.3 algos without buffer copies - strerror: avoid strncpy calls - telnet: avoid strncpy, return error on too long inputs - vtls: avoid strncpy in multissl_version() Closes #12499 - CI/distcheck: run full tests To be able to detect missing files better, this now runs the full CI test suite. If done before, it would have detected #12462 before release. Closes #12503 - docs: clean up Protocols: for cmdline options ... and some other minor polish. Closes #12496 - cmdline/gen: fix the sorting of the man page options They were previously sorted based on the file names, which use a .d extension, making "data" get placed after "data-binary" etc. Making the sort ignore the extention fixes the ordering. Reported-by: Boris Verkhovskiy Bug: https://curl.se/mail/archive-2023-12/0014.html Closes #12494 Daniel Gustafsson (9 Dec 2023) - doh: remove unused local variable The nurl variable is no longer used during probing following a refactoring, so remove. Closes #12491 Jay Satiro (8 Dec 2023) - build: fix Windows ADDRESS_FAMILY detection - Include winsock2.h for Windows ADDRESS_FAMILY detection. Prior to this change cmake detection didn't work because it included ws2def.h by itself, which is missing needed types from winsock2.h. Prior to this change autotools detection didn't work because it did not include any Windows header. In both cases libcurl would fall back on unsigned short as the address family type, which is the same as ADDRESS_FAMILY. Co-authored-by: Viktor Szakats Closes https://github.com/curl/curl/pull/12441 Daniel Stenberg (8 Dec 2023) - lib: rename Curl_strndup to Curl_memdup0 to avoid misunderstanding Since the copy does not stop at a null byte, let's not call it anything that makes you think it works like the common strndup() function. Based on feedback from Jay Satiro, Stefan Eissing and Patrick Monnerat Closes #12490 - convsrctest.pl: removed: not used, not shipped in tarballs - tests: rename tests scripts to the test number It is hard to name the scripts sensibly. Lots of them are similarly named and the name did not tell which test that used them. The new approach is rather to name them based on the test number that runs them. Also helps us see which scripts are for individual tests rather than for general test infra. - badsymbols.pl -> test1167.pl - check-deprecated.pl -> test1222.pl - check-translatable-options.pl -> test1544.pl - disable-scan.pl -> test1165.pl - error-codes.pl -> test1175.pl - errorcodes.pl -> test1477.pl - extern-scan.pl -> test1135.pl - manpage-scan.pl -> test1139.pl - manpage-syntax.pl -> test1173.pl - markdown-uppercase.pl -> test1275.pl - mem-include-scan.pl -> test1132.pl - nroff-scan.pl -> test1140.pl - option-check.pl -> test1276.pl - options-scan.pl -> test971.pl - symbol-scan.pl -> test1119.pl - version-scan.pl -> test1177.pl Closes #12487 Michał Antoniak (8 Dec 2023) - sendf: fix compiler warning with CURL_DISABLE_HEADERS_API fix MSVC warning C4189: 'htype': local variable is initialized but not referenced - when CURL_DISABLE_HEADERS_API is defined. Closes #12485 Viktor Szakats (8 Dec 2023) - tidy-up: whitespace Closes #12484 Stefan Eissing (7 Dec 2023) - test_02_download: fix paramters to test_02_27 - it is a special client that only ever uses http/2 Closes #12467 Michał Antoniak (7 Dec 2023) - vtls: remove the Curl_cft_ssl_proxy object if CURL_DISABLE_PROXY Closes #12459 Daniel Stenberg (7 Dec 2023) - lib: strndup/memdup instead of malloc, memcpy and null-terminate - bufref: use strndup - cookie: use strndup - formdata: use strndup - ftp: use strndup - gtls: use aprintf instead of malloc + strcpy * 2 - http: use strndup - mbedtls: use strndup - md4: use memdup - ntlm: use memdup - ntlm_sspi: use strndup - pingpong: use memdup - rtsp: use strndup instead of malloc, memcpy and null-terminate - sectransp: use strndup - socks_gssapi.c: use memdup - vtls: use dynbuf instead of malloc, snprintf and memcpy - vtls: use strdup instead of malloc + memcpy - wolfssh: use strndup Closes #12453 - strdup: remove the memchr check from Curl_strndup It makes it possible to clone a binary chunk of data. Closes #12453 - ftp: handle the PORT parsing without allocation Also reduces amount of *cpy() calls. Closes #12456 - RELEASE-NOTES: synced Bumped to 8.5.1 - url: for disabled protocols, mention if found in redirect To help users better understand where the URL (and denied scheme) comes from. Also removed "in libcurl" from the message, since the disabling can be done by the application. The error message now says "not supported" or "disabled" depending on why it was denied: Protocol "hej" not supported Protocol "http" disabled And in redirects: Protocol "hej" not supported (in redirect) Protocol "http" disabled (in redirect) Reported-by: Mauricio Scheffer Fixes #12465 Closes #12469 Stefan Eissing (6 Dec 2023) - sectransp_ make TLSCipherNameForNumber() available in non-verbose config Reported-by: Cajus Pollmeier Closes #12476 Fixes #12474 YX Hao (6 Dec 2023) - lib: fix variable undeclared error caused by `infof` changes `--disable-verbose` yields `CURL_DISABLE_VERBOSE_STRINGS` defined. `infof` isn't `Curl_nop_stmt` anymore: dac293c. Follow-up to dac293c Closes #12470 Viktor Szakats (6 Dec 2023) - tidy-up: fix yamllint whitespace issues in labeler.yml Follow-up to bda212911457c6fadfbba50be61afc4ca513fa56 #12466 Reviewed-by: Dan Fandrich Closes #12475 - tidy-up: fix yamllint whitespace issues Closes #12466 Chris Sauer (6 Dec 2023) - cmake: fix typo Follow-up to aace27b Closes #12464 Daniel Stenberg (6 Dec 2023) - dist: add tests/errorcodes.pl to the tarball Used by test 1477 Reported-by: Xi Ruoyao Follow-up to 0ca3a4ec9a7 Fixes #12462 Closes #12463 Dan Fandrich (6 Dec 2023) - github/labeler: update a missed key in the v5 upgrade Follow-up to ce03fe3ba Version 8.5.0 (6 Dec 2023) Daniel Stenberg (6 Dec 2023) - RELEASE-NOTES: synced The curl 8.5.0 release. Dan Fandrich (5 Dec 2023) - github/labeler: switch from the beta to labeler v5 Some keys were renamed and the dot option was made default. Closes #12458 Daniel Stenberg (5 Dec 2023) - DEPRECATE: remove NTLM_WB in June 2024 Ref: https://curl.se/mail/lib-2023-12/0010.html Closes #12451 Jacob Hoffman-Andrews (4 Dec 2023) - rustls: implement connect_blocking Closes #11647 Daniel Stenberg (4 Dec 2023) - examples/rtsp-options.c: add Just a bare bones RTSP example using CURLOPT_RTSP_SESSION_ID and CURLOPT_RTSP_REQUEST set to CURL_RTSPREQ_OPTIONS. Closes #12452 Stefan Eissing (4 Dec 2023) - ngtcp2: ignore errors on unknown streams - expecially in is_alive checks on connections, we might see incoming packets on streams already forgotten and closed, leading to errors reported by nghttp3. Ignore those. Closes #12449 Daniel Stenberg (4 Dec 2023) - docs: make all examples in all libcurl man pages compile Closes #12448 - checksrc.pl: support #line instructions makes it identify the correct source file and line - GHA/man-examples: verify libcurl man page examples - verify-examples.pl: verify that all man page examples compile clean - RELEASE-NOTES: synced Graham Campbell (2 Dec 2023) - http3: bump ngtcp2 and nghttp3 versions nghttp3 v1.1.0 ngtcp2 v1.1.0 In docs and CI Closes #12446 - CI/quiche: use `3.1.4+quic` consistently in CI workflows Closes #12447 Viktor Szakats (2 Dec 2023) - test1545: disable deprecation warnings Fixes: https://ci.appveyor.com/project/curlorg/curl/builds/48631551/job/bhx74e0i66yr p6pk#L1205 Same with details: https://ci.appveyor.com/project/curlorg/curl/builds/48662893/job/ol8a78q9gmil b6wt#L1263 ``` tests/libtest/lib1545.c:38:3: error: 'curl_formadd' is deprecated: since 7.56 .0. Use curl_mime_init() [-Werror=deprecated-declarations] 38 | curl_formadd(&m_formpost, &lastptr, CURLFORM_COPYNAME, "file", | ^~~~~~~~~~~~ [...] ``` Follow-up to 07a3cd83e0456ca17dfd8c3104af7cf45b7a1ff5 #12421 Fixes #12445 Closes #12444 Daniel Stenberg (2 Dec 2023) - INSTALL: update list of ports and CPU archs - symbols-in-versions: the CLOSEPOLICY options are deprecated The were used with the CURLOPT_CLOSEPOLICY option, which *never* worked. z2_ (1 Dec 2023) - build: fix builds that disable protocols but not digest auth - Build base64 functions if digest auth is not disabled. Prior to this change if some protocols were disabled but not digest auth then a build error would occur due to missing base64 functions. Fixes https://github.com/curl/curl/issues/12440 Closes https://github.com/curl/curl/pull/12442 Michał Antoniak (1 Dec 2023) - connect: reduce number of transportation providers Use only the ones necessary - the ones that are built-in. Saves a few bytes in the resulting code. Closes #12438 David Benjamin (1 Dec 2023) - vtls: consistently use typedef names for OpenSSL structs The foo_st names don't appear in OpenSSL public API documentation. The FOO typedefs are more common. This header was already referencing SSL_CTX via . There is a comment about avoiding , but OpenSSL actually declares all the typedefs in , which is already included by (and every other OpenSSL header), so just use that. Though I've included it just to be explicit. (I'm also fairly sure including already triggers the Schannel conflicts anyway. The comment was probably just out of date.) Closes #12439 Lau (1 Dec 2023) - libcurl-security.3: fix typo Fixed minimal typo. Closes #12437 Stefan Eissing (1 Dec 2023) - ngtcp2: fix races in stream handling - fix cases where ngtcp2 invokes callbacks on streams that nghttp3 has already forgotten. Ignore the NGHTTP3_ERR_STREAM_NOT_FOUND in these cases as it is normal behaviour. Closes #12435 Emanuele Torre (1 Dec 2023) - tool_writeout_json: fix JSON encoding of non-ascii bytes char variables if unspecified can be either signed or unsigned depending on the platform according to the C standard; in most platforms, they are signed. This meant that the *i<32 waas always true for bytes with the top bit set. So they were always getting encoded as \uXXXX, and then since they were also signed negative, they were getting extended with 1s causing '\xe2' to be expanded to \uffffffe2, for example: $ curl --variable 'v=“' --expand-write-out '{{v:json}}\n' file:///dev/nul l \uffffffe2\uffffff80\uffffff9c I fixed this bug by making the code use explicitly unsigned char* variables instead of char* variables. Test 268 verifies Reported-by: iconoclasthero Closes #12434 Stefan Eissing (1 Dec 2023) - cf-socket: TCP trace output local address used in connect Closes #12427 Jay Satiro (1 Dec 2023) - CURLINFO_PRETRANSFER_TIME_T.3: fix time explanation - Change CURLINFO_PRETRANSFER_TIME_T explanation to say that it includes protocol-specific instructions that trigger a transfer. Prior to this change it explicitly said that it did not include those instructions in the time, but that is incorrect. The change is a copy of the fixed explanation already in CURLINFO_PRETRANSFER_TIME, fixed by ec8dcd7b. Reported-by: eeverettrbx@users.noreply.github.com Fixes https://github.com/curl/curl/issues/12431 Closes https://github.com/curl/curl/pull/12432 Daniel Stenberg (30 Nov 2023) - multi: during ratelimit multi_getsock should return no sockets ... as there is nothing to wait for then, it just waits. Otherwise, this causes much more CPU work and updates than necessary during ratelimit periods. Ref: https://curl.se/mail/lib-2023-11/0056.html Closes #12430 Dmitry Karpov (30 Nov 2023) - transfer: abort pause send when connection is marked for closing This handles cases of some bi-directional "upgrade" scenarios (i.e. WebSockets) where sending is paused until some "upgrade" handshake is completed, but server rejects the handshake and closes the connection. Closes #12428 Daniel Stenberg (28 Nov 2023) - RELEASE-NOTES: synced - openssl: when a session-ID is reused, skip OCSP stapling Fixes #12399 Reported-by: Alexey Larikov Closes #12418 - test1545: test doing curl_formadd twice with missing file Reproduces #12410 Verifies the fix Closes #12421 - Curl_http_body: cleanup properly when Curl_getformdata errors Reported-by: yushicheng7788 on github Based-on-work-by: yushicheng7788 on github Fixes #12410 Closes #12421 - test1477: verify that libcurl-errors.3 and public headers are synced The script errorcodes.pl extracts all error codes from all headers and checks that they are all documented, then checks that all documented error codes are also specified in a header file. Closes #12424 - libcurl-errors.3: sync with current public headers Closes #12424 Stefan Eissing (28 Nov 2023) - test459: fix for parallel runs - change warniing message to work better with varying filename length. - adapt test output check to new formatting Follow-up to 97ccc4479f77ba3191c6 Closes #12423 Daniel Stenberg (27 Nov 2023) - tool_cb_prg: make the carriage return fit for wide progress bars When the progress bar was made max width (256 columns), the fly() function attempted to generate its output buffer too long so that the trailing carriage return would not fit and then the output would show wrongly. The fly function is called when the expected total transfer is unknown, which could be one or more progress calls before the actual progress meter get shown when the expected transfer size is provided. This new take also replaces the msnprintf() call with a much simpler memset() for speed. Reported-by: Tim Hill Fixes #12407 Closes #12415 - tool_parsecfg: make warning output propose double-quoting When the config file parser detects a word that *probably* should be quoted, mention double-quotes as a possible remedy. Test 459 verifies. Proposed-by: Jiehong on github Fixes #12409 Closes #12412 Jay Satiro (26 Nov 2023) - curl.rc: switch out the copyright symbol for plain ASCII .. like we already do for libcurl.rc. libcurl.rc copyright symbol used to cause a "non-ascii 8-bit codepoint" warning so it was switched to ascii. Ref: https://github.com/curl/curl/commit/1ca62bb5#commitcomment-133474972 Suggested-by: Robert Southee Closes https://github.com/curl/curl/pull/12403 Daniel Stenberg (26 Nov 2023) - conncache: use the closure handle when disconnecting surplus connections Use the closure handle for disconnecting connection cache entries so that anything that happens during the disconnect is not stored and associated with the 'data' handle which already just finished a transfer and it is important that details from the unrelated disconnect does not taint meta-data in the data handle. Like storing the response code. This also adjust test 1506. Unfortunately it also removes a key part of the test that verifies that a connection is closed since when this output vanishes (because the closure handle is used), we don't know exactly that the connection actually gets closed in this test... Reported-by: ohyeaah on github Fixes #12367 Closes #12405 - RELEASE-NOTES: synced Stefan Eissing (24 Nov 2023) - quic: make eyeballers connect retries stop at weird replies - when a connect immediately goes into DRAINING state, do not attempt retries in the QUIC connection filter. Instead, return CURLE_WEIRD_SERVER_REPLY - When eyeballing, interpret CURLE_WEIRD_SERVER_REPLY as an inconclusive answer. When all addresses have been attempted, rewind the address list once on an inconclusive answer. - refs #11832 where connects were retried indefinitely until the overall timeout fired Closes #12400 Daniel Stenberg (24 Nov 2023) - CI: verify libcurl function SYNPOSIS sections With the .github/scripits/verify-synopsis.pl script Closes #12402 - docs/libcurl: SYNSOPSIS cleanup - use the correct include file - make sure they are declared as in the header file - fix minor nroff syntax mistakes (missing .fi) These are verified by verify-synopsis.pl, which extracts the SYNPOSIS code and runs it through gcc. Closes #12402 - sendf: fix comment typo - fopen: allocate the dir after fopen Move the allocation of the directory name down to after the fopen() call to allow that shortcut code path to avoid a superfluous malloc+free cycle. Follow-up to 73b65e94f35311 Closes #12398 Stefan Eissing (24 Nov 2023) - transfer: cleanup done+excess handling - add `SingleRequest->download_done` as indicator that all download bytes have been received - remove `stop_reading` bool from readwrite functions - move excess body handling into client download writer Closes #12371 Daniel Stenberg (23 Nov 2023) - fopen: create new file using old file's mode Because the function renames the temp file to the target name as a last step, if the file was previously owned by a different user, not ORing the old mode could otherwise end up creating a file that was no longer readable by the original owner after save. Reported-by: Loïc Yhuel Fixes #12299 Closes #12395 - test1476: require proxy Follow-up from 323df4261c3542 Closes #12394 - fopen: create short(er) temporary file name Only using random letters in the name plus a ".tmp" extension. Not by appending characters to the final file name. Reported-by: Maksymilian Arciemowicz Closes #12388 Stefan Eissing (23 Nov 2023) - tests: git ignore generated second-hsts.txt file File is generated in test lib1900 Follow-up to 7cb03229d9e9c5 Closes #12393 Viktor Szakats (23 Nov 2023) - openssl: enable `infof_certstack` for 1.1 and LibreSSL 3.6 Lower the barrier to enable `infof_certstack()` from OpenSSL 3 to OpenSSL 1.1.x, and LibreSSL 3.6 or upper. With the caveat, that "group name" and "type name" are missing from the log output with these TLS backends. Follow-up to b6e6d4ff8f253c8b8055bab9d4d6a10f9be109f3 #12030 Reviewed-by: Daniel Stenberg Closes #12385 Daniel Stenberg (23 Nov 2023) - urldata: fix typo in comment - CI: codespell The list of words to ignore is in the file .github/scripts/codespell-ignore.txt Closes #12390 - lib: fix comment typos Five separate ones, found by codespell Closes #12390 - test1476: verify cookie PSL mixed case - cookie: lowercase the domain names before PSL checks Reported-by: Harry Sintonen Closes #12387 Viktor Szakats (23 Nov 2023) - openssl: fix building with v3 `no-deprecated` + add CI test - build quictls with `no-deprecated` in CI to have test coverage for this OpenSSL 3 configuration. - don't call `OpenSSL_add_all_algorithms()`, `OpenSSL_add_all_digests()`. The caller code is meant for OpenSSL 3, while these two functions were only necessary before OpenSSL 1.1.0. They are missing from OpenSSL 3 if built with option `no-deprecated`, causing build errors: ``` vtls/openssl.c:4097:3: error: call to undeclared function 'OpenSSL_add_all_ algorithms'; ISO C99 and later do not support implicit function declaration s [-Wimplicit-function-declaration] vtls/openssl.c:4098:3: error: call to undeclared function 'OpenSSL_add_all_ digests'; ISO C99 and later do not support implicit function declarations [ -Wimplicit-function-declaration] ``` Ref: https://ci.appveyor.com/project/curlorg/curl-for-win/builds/48587418?f ullLog=true#L7667 Regression from b6e6d4ff8f253c8b8055bab9d4d6a10f9be109f3 #12030 Bug: https://github.com/curl/curl/issues/12380#issuecomment-1822944669 Reviewed-by: Alex Bozarth - vquic/curl_ngtcp2: fix using `SSL_get_peer_certificate` with `no-deprecated` quictls 3 builds. Do it by moving an existing solution for this from `vtls/openssl.c` to `vtls/openssl.h` and adjusting caller code. ``` vquic/curl_ngtcp2.c:1950:19: error: implicit declaration of function 'SSL_g et_peer_certificate'; did you mean 'SSL_get1_peer_certificate'? [-Wimplicit -function-declaration] ``` Ref: https://github.com/curl/curl/actions/runs/6960723097/job/18940818625#s tep:24:1178 - curl_ntlm_core: fix `-Wunused-parameter`, `-Wunused-variable` and `-Wunused-function` when trying to build curl with NTLM enabled but without the necessary TLS backend (with DES) support. Closes #12384 - curl.h: delete Symbian OS references curl deprecated Symbian OS in 3d64031fa7a80ac4ae3fd09a5939196268b92f81 via #5989. Delete references to it from public headers, because there is no fresh release to use those headers with. Reviewed-by: Dan Fandrich Reviewed-by: Jay Satiro Closes #12378 - windows: use built-in `_WIN32` macro to detect Windows Windows compilers define `_WIN32` automatically. Windows SDK headers or build env defines `WIN32`, or we have to take care of it. The agreement seems to be that `_WIN32` is the preferred practice here. Make the source code rely on that to detect we're building for Windows. Public `curl.h` was using `WIN32`, `__WIN32__` and `CURL_WIN32` for Windows detection, next to the official `_WIN32`. After this patch it only uses `_WIN32` for this. Also, make it stop defining `CURL_WIN32`. There is a slight chance these break compatibility with Windows compilers that fail to define `_WIN32`. I'm not aware of any obsolete or modern compiler affected, but in case there is one, one possible solution is to define this macro manually. grepping for `WIN32` remains useful to discover Windows-specific code. Also: - extend `checksrc` to ensure we're not using `WIN32` anymore. - apply minor formatting here and there. - delete unnecessary checks for `!MSDOS` when `_WIN32` is present. Co-authored-by: Jay Satiro Reviewed-by: Daniel Stenberg Closes #12376 Stefan Eissing (22 Nov 2023) - url: ConnectionExists revisited - have common pattern of `if not match, continue` - revert pages long if()s to return early - move dead connection check to later since it may be relatively expensive - check multiuse also when NOT building with NGHTTP2 - for MULTIUSE bundles, verify that the inspected connection indeed supports multiplexing when in use (bundles may contain a mix of connection, afaict) Closes #12373 Daniel Stenberg (22 Nov 2023) - CURLMOPT_MAX_CONCURRENT_STREAMS: make sure the set value is within range ... or use the default value. Also clarify the documentation language somewhat. Closes #12382 - urldata: make maxconnects a 32 bit value "2^32 idle connections ought to be enough for anybody" Closes #12375 - FEATURES: update the URL phrasing The URL is length limited since a while back so "no limit" simply is not true anymore. Mention the URL RFC standard used instead. Closes #12383 - wolfssh: remove redundant static prototypes vssh/wolfssh.c:346:18: error: redundant redeclaration of ‘wscp_recv’ [-We rror=redundant-decls] Closes #12381 - setopt: remove superfluous use of ternary expressions Closes #12374 - mime: store "form escape" as a single bit Closes #12374 - setopt: check CURLOPT_TFTP_BLKSIZE range on set ... instead of later when the transfer is about to happen. Closes #12374 Viktor Szakats (21 Nov 2023) - build: add more picky warnings and fix them Enable more picky compiler warnings. I've found these options in the nghttp3 project when implementing the CMake quick picky warning functionality for it [1]. `-Wunused-macros` was too noisy to keep around, but fixed a few issues it revealed while testing. - autotools: reflect the more precisely-versioned clang warnings. Follow-up to 033f8e2a08eb1d3102f08c4d8c8e85470f8b460e #12324 - autotools: sync between clang and gcc the way we set `no-multichar`. - autotools: avoid setting `-Wstrict-aliasing=3` twice. - autotools: disable `-Wmissing-noreturn` for MSYS gcc targets [2]. It triggers in libtool-generated stub code. - lib/timeval: delete a redundant `!MSDOS` guard from a `WIN32` branch. - lib/curl_setup.h: delete duplicate declaration for `fileno`. Added in initial commit ae1912cb0d494b48d514d937826c9fe83ec96c4d (1999-12-29). This suggests this may not be needed anymore, but if it does, we may restore this for those specific (non-Windows) systems. - lib: delete unused macro `FTP_BUFFER_ALLOCSIZE` since c1d6fe2aaa5a26e49a69a4f2495b3cc7a24d9394. - lib: delete unused macro `isxdigit_ascii` since f65f750742068f579f4ee6d8539ed9d5f0afcb85. - lib/mqtt: delete unused macro `MQTT_HEADER_LEN`. - lib/multi: delete unused macro `SH_READ`/`SH_WRITE`. - lib/hostip: add `noreturn` function attribute via new `CURL_NORETURN` macro. - lib/mprintf: delete duplicate declaration for `Curl_dyn_vprintf`. - lib/rand: fix `-Wunreachable-code` and related fallouts [3]. - lib/setopt: fix `-Wunreachable-code-break`. - lib/system_win32 and lib/timeval: fix double declarations for `Curl_freq` and `Curl_isVistaOrGreater` in CMake UNITY mode [4]. - lib/warnless: fix double declarations in CMake UNITY mode [5]. This was due to force-disabling the header guard of `warnless.h` to to reapply it to source code coming after `warnless.c` in UNITY builds. This reapplied declarations too, causing the warnings. Solved by adding a header guard for the lines that actually need to be reapplied. - lib/vauth/digest: fix `-Wunreachable-code-break` [6]. - lib/vssh/libssh2: fix `-Wunreachable-code-break` and delete redundant block. - lib/vtls/sectransp: fix `-Wunreachable-code-break` [7]. - lib/vtls/sectransp: suppress `-Wunreachable-code`. Detected in `else` branches of dynamic feature checks, with results known at compile-time, e.g. ```c if(SecCertificateCopySubjectSummary) /* -> true */ ``` Likely fixable as a separate micro-project, but given SecureTransport is deprecated anyway, let's just silence these locally. - src/tool_help: delete duplicate declaration for `helptext`. - src/tool_xattr: fix `-Wunreachable-code`. - tests: delete duplicate declaration for `unitfail` [8]. - tests: delete duplicate declaration for `strncasecompare`. - tests/libtest: delete duplicate declaration for `gethostname`. Originally added in 687df5c8c39c370a59999b9afc0917d808d978b7 (2010-08-02). Got complicated later: c49e9683b85ba9d12cbb6eebc4ab2c8dba68fbdc If there are still systems around with warnings, we may restore the prototype, but limited for those systems. - tests/lib2305: delete duplicate declaration for `libtest_debug_config`. - tests/h2-download: fix `-Wunreachable-code-break`. [1] https://github.com/ngtcp2/nghttp3/blob/a70edb08e954d690e8fb2c1df999b5a056 f8bf9f/cmake/PickyWarningsC.cmake [2] https://ci.appveyor.com/project/curlorg/curl/builds/48553586/job/3qkgjaui qla5fj45?fullLog=true#L1675 [3] https://github.com/curl/curl/actions/runs/6880886309/job/18716044703?pr=1 2331#step:7:72 https://github.com/curl/curl/actions/runs/6883016087/job/18722707368?pr=1 2331#step:7:109 [4] https://ci.appveyor.com/project/curlorg/curl/builds/48555101/job/9g15qkrr iklpf1ut#L204 [5] https://ci.appveyor.com/project/curlorg/curl/builds/48555101/job/9g15qkrr iklpf1ut#L218 [6] https://github.com/curl/curl/actions/runs/6880886309/job/18716042927?pr=1 2331#step:7:290 [7] https://github.com/curl/curl/actions/runs/6891484996/job/18746659406?pr=1 2331#step:9:1193 [8] https://github.com/curl/curl/actions/runs/6882803986/job/18722082562?pr=1 2331#step:33:1870 Closes #12331 Daniel Stenberg (21 Nov 2023) - transfer: avoid unreachable expression If curl_off_t and size_t have the same size (which is common on modern 64 bit systems), a condition cannot occur which Coverity pointed out. Avoid the warning by having the code conditionally only used if curl_off_t actually is larger. Follow-up to 1cd2f0072fa482e25baa2 Closes #12370 Stefan Eissing (21 Nov 2023) - transfer: readwrite improvements - changed header/chunk/handler->readwrite prototypes to accept `buf`, `blen` and a `pconsumed` pointer. They now get the buffer to work on and report back how many bytes they consumed - eliminated `k->str` in SingleRequest - improved excess data handling to properly calculate with any body data left in the headerb buffer - eliminated `k->badheader` enum to only be a bool Closes #12283 Daniel Stenberg (21 Nov 2023) - RELEASE-NOTES: synced Jiří Hruška (21 Nov 2023) - transfer: avoid calling the read callback again after EOF Regression since 7f43f3dc5994d01b12 (7.84.0) Bug: https://curl.se/mail/lib-2023-11/0017.html Closes #12363 Daniel Stenberg (21 Nov 2023) - doh: provide better return code for responses w/o addresses Previously it was wrongly returning CURLE_OUT_OF_MEMORY when the response did not contain any addresses. Now it more accurately returns CURLE_COULDNT_RESOLVE_HOST. Reported-by: lRoccoon on github Fixes #12365 Closes #12366 Stefan Eissing (21 Nov 2023) - HTTP/2, HTTP/3: handle detach of onoing transfers - refs #12356 where a UAF is reported when closing a connection with a stream whose easy handle was cleaned up already - handle DETACH events same as DONE events in h2/h3 filters Fixes #12356 Reported-by: Paweł Wegner Closes #12364 Viktor Szakats (20 Nov 2023) - autotools: stop setting `-std=gnu89` with `--enable-warnings` Do not alter the C standard when building with `--enable-warnings` when building with gcc. On one hand this alters warning results compared to a default build. On the other, it may produce different binaries, which is unexpected. Also fix new warnings that appeared after removing `-std=gnu89`: - include: fix public curl headers to use the correct printf mask for `CURL_FORMAT_CURL_OFF_T` and `CURL_FORMAT_CURL_OFF_TU` with mingw-w64 and Visual Studio 2013 and newer. This fixes the printf mask warnings in examples and tests. E.g. [1] - conncache: fix printf format string [2]. - http2: fix potential null pointer dereference [3]. (seen on Slackware with gcc 11.) - libssh: fix printf format string in SFTP code [4]. Also make MSVC builds compatible with old CRT versions. - libssh2: fix printf format string in SFTP code for MSVC. Applying the same fix as for libssh above. - unit1395: fix `argument is null` and related issues [5]: - stop calling `strcmp()` with NULL to avoid undefined behaviour. - fix checking results if some of them were NULL. - do not pass NULL to printf `%s`. - ci: keep a build job with `-std=gnu89` to continue testing for C89-compliance. We can apply this to other gcc jobs as needed. Ref: b23ce2cee7329bbf425f18b49973b7a5f23dfcb4 (2022-09-23) #9542 [1] https://dev.azure.com/daniel0244/curl/_build/results?buildId=18581&view=l ogs&jobId=ccf9cc6d-2ef1-5cf2-2c09-30f0c14f923b [2] https://github.com/curl/curl/actions/runs/6896854263/job/18763831142?pr=1 2346#step:6:67 [3] https://github.com/curl/curl/actions/runs/6896854253/job/18763839238?pr=1 2346#step:30:214 [4] https://github.com/curl/curl/actions/runs/6896854253/job/18763838007?pr=1 2346#step:29:895 [5] https://github.com/curl/curl/actions/runs/6896854253/job/18763836775?pr=1 2346#step:33:1689 Closes #12346 - autotools: fix/improve gcc and Apple clang version detection - Before this patch we expected `n.n` `-dumpversion` output, but Ubuntu may return `n-win32` (also with `-dumpfullversion`). Causing these errors and failing to enable picky warnings: ``` ../configure: line 23845: test: : integer expression expected ``` Ref: https://github.com/libssh2/libssh2/actions/runs/6263453828/job/1700789 3718#step:5:143 Fix that by stripping any dash-suffix and handling a dotless (major-only) version number by assuming `.0` in that case. `9.3-posix`, `9.3-win32`, `6`, `9.3.0`, `11`, `11.2`, `11.2.0` Ref: https://github.com/mamedev/mame/pull/9767 - fix Apple clang version detection for releases between 'Apple LLVM version 7.3.0' and 'Apple LLVM version 10.0.1' where the version was under-detected as 3.7 llvm/clang equivalent. - fix Apple clang version detection for 'Apple clang version 11.0.0' and newer where the Apple clang version was detected, instead of its llvm/clang equivalent. - display detected clang/gcc/icc compiler version. Via libssh2: - https://github.com/libssh2/libssh2/commit/00a3b88c51cdb407fbbb347a2e38c5c7d 89875ad https://github.com/libssh2/libssh2/pull/1187 - https://github.com/libssh2/libssh2/commit/89ccc83c7da73e7ca3a112e3500081319 42b592e https://github.com/libssh2/libssh2/pull/1232 Closes #12362 - autotools: delete LCC compiler support bits Follow-up to fd7ef00f4305a2919e6950def1cf83d0110a4acd #12222 Closes #12357 - cmake: add test for `DISABLE` options, add `CURL_DISABLE_HEADERS_API` - tests: verify CMake `DISABLE` options. Make an exception for 2 CMake-only ones, and one more that's using a different naming scheme, also in autotools and source. - cmake: add support for `CURL_DISABLE_HEADERS_API`. Suggested-by: Daniel Stenberg Ref: https://github.com/curl/curl/pull/12345#pullrequestreview-1736238641 Closes #12353 Jacob Hoffman-Andrews (20 Nov 2023) - hyper: temporarily remove HTTP/2 support The current design of the Hyper integration requires rebuilding the Hyper clientconn for each request. However, building the clientconn requires resending the HTTP/2 connection preface, which is incorrect from a protocol perspective. That in turn causes servers to send GOAWAY frames, effectively degrading performance to "no connection reuse" in the best case. It may also be triggering some bugs where requests get dropped entirely and reconnects take too long. This doesn't rule out HTTP/2 support with Hyper, but it may take a redesign of the Hyper integration in order to make things work. Closes #12191 Jay Satiro (20 Nov 2023) - schannel: fix unused variable warning Bug: https://github.com/curl/curl/pull/12349#issuecomment-1818000846 Reported-by: Viktor Szakats Closes https://github.com/curl/curl/pull/12361 Daniel Stenberg (19 Nov 2023) - url: find scheme with a "perfect hash" Instead of a loop to scan over the potentially 30+ scheme names, this uses a "perfect hash" table. This works fine because the set of schemes is known and cannot change in a build. The hash algorithm and table size is made to only make a single scheme index per table entry. The perfect hash is generated by a separate tool (scripts/schemetable.c) Closes #12347 - scripts: add schemetable.c This tool generates a scheme-matching table. It iterates over a number of different initial and shift values in order to find the hash algorithm that needs the smallest possible table. The generated hash function, table and table size then needs to be used by the url.c:Curl_getn_scheme_handler() function. Stefan Eissing (19 Nov 2023) - vtls/vquic, keep peer name information together - add `struct ssl_peer` to keep hostname, dispname and sni for a filter - allocate `sni` for use in VTLS backend - eliminate `Curl_ssl_snihost()` and its use of the download buffer - use ssl_peer in SSL and QUIC filters Closes #12349 Viktor Szakats (18 Nov 2023) - build: always revert `#pragma GCC diagnostic` after use Before this patch some source files were overriding gcc warning options, but without restoring them at the end of the file. In CMake UNITY builds these options spilled over to the remainder of the source code, effecitvely disabling them for a larger portion of the codebase than intended. `#pragma clang diagnostic` didn't have such issue in the codebase. Reviewed-by: Marcel Raad Closes #12352 - tidy-up: casing typos, delete unused Windows version aliases - cmake: fix casing of `UnixSockets` to match the rest of the codebase. - curl-compilers.m4: fix casing in a comment. - setup-win32: delete unused Windows version constant aliases. Reviewed-by: Marcel Raad Closes #12351 - keylog: disable if unused Fully disable keylog code if there is no TLS or QUIC subsystem using it. Closes #12350 - cmake: add `CURL_DISABLE_BINDLOCAL` option To match similar autotools option. Default is `ON`. Reviewed-by: Daniel Stenberg Closes #12345 - url: fix `-Wzero-length-array` with no protocols Fixes: ``` ./lib/url.c:178:56: warning: use of an empty initializer is a C2x extension [ -Wc2x-extensions] 178 | static const struct Curl_handler * const protocols[] = { | ^ ./lib/url.c:178:56: warning: zero size arrays are an extension [-Wzero-length -array] ``` Closes #12344 - url: fix builds with `CURL_DISABLE_HTTP` Fixes: ``` ./lib/url.c:456:35: error: no member named 'formp' in 'struct UrlState' 456 | Curl_mime_cleanpart(data->state.formp); | ~~~~~~~~~~~ ^ ``` Regression from 74b87a8af13a155c659227f5acfa78243a8b2aa6 #11682 Closes #12343 - http: fix `-Wunused-parameter` with no auth and no proxy ``` lib/http.c:734:26: warning: unused parameter 'proxy' [-Wunused-parameter] bool proxy) ^ ``` Reviewed-by: Marcel Raad Closes #12338 Daniel Stenberg (16 Nov 2023) - TODO: Some TLS options are not offered for HTTPS proxies Closes #12286 Closes #12342 - RELEASE-NOTES: synced - duphandle: make dupset() not return with pointers to old alloced data As the blob pointers are to be duplicated, the function must not return mid-function with lingering pointers to the old handle's allocated data, as that would lead to double-free in OOM situations. Make sure to clear all destination pointers first to avoid this risk. Closes #12337 Viktor Szakats (16 Nov 2023) - http: fix `-Wunused-variable` compiler warning Fix compiler warnings in builds with disabled auths, NTLM and SPNEGO. E.g. with `CURL_DISABLE_BASIC_AUTH` + `CURL_DISABLE_BEARER_AUTH` + `CURL_DISABLE_DIGEST_AUTH` + `CURL_DISABLE_NEGOTIATE_AUTH` + `CURL_DISABLE_NTLM` on non-Windows. ``` ./curl/lib/http.c:737:12: warning: unused variable 'result' [-Wunused-variabl e] CURLcode result = CURLE_OK; ^ ./curl/lib/http.c:995:18: warning: variable 'availp' set but not used [-Wunus ed-but-set-variable] unsigned long *availp; ^ ./curl/lib/http.c:996:16: warning: variable 'authp' set but not used [-Wunuse d-but-set-variable] struct auth *authp; ^ ``` Regression from e92edfbef64448ef461117769881f3ed776dec4e #11490 Fixes #12228 Closes #12335 Jay Satiro (16 Nov 2023) - tool: support bold headers in Windows - If virtual terminal processing is enabled in Windows then use ANSI escape codes Esc[1m and Esc[22m to turn bold on and off. Suggested-by: Gisle Vanem Ref: https://github.com/curl/curl/discussions/11770 Closes https://github.com/curl/curl/pull/12321 Viktor Szakats (15 Nov 2023) - build: fix libssh2 + `CURL_DISABLE_DIGEST_AUTH` + `CURL_DISABLE_AWS` Builds with libssh2 + `-DCURL_DISABLE_DIGEST_AUTH=ON` + `-DCURL_DISABLE_AWS=ON` in combination with either Schannel on Windows, or `-DCURL_DISABLE_NTLM=ON` on other operating systems failed while compiling due to a missing HMAC declaration. The reason is that HMAC is required by `lib/sha256.c` which publishes `Curl_sha256it()` which is required by `lib/vssh/libssh2.c` when building for libssh2 v1.8.2 (2019-05-25) or older. Make sure to compile the HMAC bits for a successful build. Both HMAC and `Curl_sha256it()` rely on the same internals, so splitting them into separate sources isn't practical. Fixes: ``` [...] In file included from ./curl/_x64-win-ucrt-cmake-llvm-bld/lib/CMakeFiles/libc url_object.dir/Unity/unity_0_c.c:310: ./curl/lib/sha256.c:527:42: error: array has incomplete element type 'const s truct HMAC_params' 527 | const struct HMAC_params Curl_HMAC_SHA256[] = { | ^ ./curl/lib/curl_sha256.h:34:21: note: forward declaration of 'struct HMAC_par ams' [...] ``` Regression from e92edfbef64448ef461117769881f3ed776dec4e #11490 Fixes #12273 Closes #12332 Daniel Stenberg (15 Nov 2023) - duphandle: also free 'outcurl->cookies' in error path Fixes memory-leak when OOM mid-function Use plain free instead of safefree, since the entire struct is freed below. Remove some free calls that is already freed in Curl_freeset() Closes #12329 Viktor Szakats (15 Nov 2023) - config-win32: set `HAVE_SNPRINTF` for mingw-w64 It's available in all mingw-w64 releases. We already pre-fill this detection in CMake. Closes #12325 - sasl: fix `-Wunused-function` compiler warning In builds with disabled auths. ``` lib/curl_sasl.c:266:17: warning: unused function 'get_server_message' [-Wunus ed-function] static CURLcode get_server_message(struct SASL *sasl, struct Curl_easy *data, ^ 1 warning generated. ``` Ref: https://github.com/curl/trurl/actions/runs/6871732122/job/18689066151#st ep:3:3822 Reviewed-by: Daniel Stenberg Closes #12326 - build: picky warning updates - cmake: sync some picky gcc warnings with autotools. - cmake, autotools: add `-Wold-style-definition` for clang too. - cmake: more precise version info for old clang options. - cmake: use `IN LISTS` syntax in `foreach()`. Reviewed-by: Daniel Stenberg Reviewed-by: Marcel Raad Closes #12324 Daniel Stenberg (15 Nov 2023) - urldata: move cookielist from UserDefined to UrlState 1. Because the value is not strictly set with a setopt option. 2. Because otherwise when duping a handle when all the set.* fields are first copied and an error happens (think out of memory mid-function), the function would easily free the list *before* it was deep-copied, which could lead to a double-free. Closes #12323 Viktor Szakats (14 Nov 2023) - autotools: avoid passing `LDFLAGS` twice to libcurl autotools passes `LDFLAGS` automatically linker commands. curl's `lib/Makefile.am` customizes libcurl linker flags. In that customization, it added `LDFLAGS` to the custom flags. This resulted in passing `LDFLAGS` _twice_ to the `libtool` command. Most of the time this is benign, but some `LDFLAGS` options can break the build when passed twice. One such example is passing `.o` files, e.g. `crt*.o` files necessary when customizing the C runtime, e.g. for MUSL builds. Passing them twice resulted in duplicate symbol errors: ``` libtool: link: clang-15 --target=aarch64-unknown-linux-musl [...] /usr/lib/a arch64-linux-musl/crt1.o [...] /usr/lib/aarch64-linux-musl/crt1.o [...] ld.lld-15: error: duplicate symbol: _start >>> defined at crt1.c >>> /usr/lib/aarch64-linux-musl/crt1.o:(.text+0x0) >>> defined at crt1.c >>> /usr/lib/aarch64-linux-musl/crt1.o:(.text+0x0) [...] clang: error: linker command failed with exit code 1 (use -v to see invocatio n) ``` This behaviour came with commit 1a593191c2769a47b8c3e4d9715ec9f6dddf5e36 (2013-07-23) as a fix for bug https://curl.haxx.se/bug/view.cgi?id=1217. The patch was a works-for-me hack that ended up merged in curl: https://sourceforge.net/p/curl/bugs/1217/#06ef With the root cause remaining unclear. Perhaps the SUNPro 12 linker was sensitive to `-L` `-l` order, requiring `-L` first? This would be unusual and suggests a bug in either the linker or in `libtool`. The curl build does pass the list of detected libs via its own `LIBCURL_LIBS` variable, which ends up before `LDFLAGS` on the `libtool` command line, but it's the job of `libtool` to ensure that even a peculiar linker gets the options in the expected order. Also because autotools passes `LDFLAGS` last, making it hardly possible to pass anything after it. Perhaps in the 10 years since this issue, this already got a fix upstream. This patch deletes `LDFLAGS` from our customized libcurl options, leaving a single copy of them as passed by autotools automatically. Reverts 1a593191c2769a47b8c3e4d9715ec9f6dddf5e36 Closes #12310 - autotools: accept linker flags via `CURL_LDFLAGS_{LIB,BIN}` To allow passing `LDFLAGS` specific to libcurl (`CURL_LDFLAGS_LIB`) and curl tool (`CURL_LDFLAGS_BIN`). This makes it possible to build libcurl and curl with a single invocation with lib- and tool-specific custom linker flags. Such flag can be enabling `.map` files, a `.def` file for libcurl DLL, controlling static/shared, incl. requesting a static curl tool (with `-static-libtool-libs`) while building both shared and static libcurl. curl-for-win uses the above and some more. These options are already supported in `Makefile.mk`. CMake has built-in variables for this. Closes #12312 Jay Satiro (14 Nov 2023) - tool_cb_hdr: add an additional parsing check - Don't dereference the past-the-end element when parsing the server's Content-disposition header. As 'p' is advanced it can point to the past-the-end element and prior to this change 'p' could be dereferenced in that case. Technically the past-the-end element is not out of bounds because dynbuf (which manages the header line) automatically adds a null terminator to every buffer and that is not included in the buffer length passed to the header callback. Closes https://github.com/curl/curl/pull/12320 Philip Heiduck (14 Nov 2023) - .cirrus.yml: freebsd 14 ensure curl works on latest freebsd version Closes #12053 Daniel Stenberg (13 Nov 2023) - easy: in duphandle, init the cookies for the new handle ... not the source handle. Closes #12318 - duphandle: use strdup to clone *COPYPOSTFIELDS if size is not set Previously it would unconditionally use the size, which is set to -1 when strlen is requested. Updated test 544 to verify. Closes #12317 - RELEASE-NOTES: synced - curl_easy_duphandle.3: clarify how HSTS and alt-svc are duped Closes #12315 - urldata: move hstslist from 'set' to 'state' To make it work properly with curl_easy_duphandle(). This, because duphandle duplicates the entire 'UserDefined' struct by plain copy while 'hstslist' is a linked curl_list of file names. This would lead to a double-free when the second of the two involved easy handles were closed. Closes #12315 - test1900: verify duphandle with HSTS using multiple files Closes #12315 Goro FUJI (13 Nov 2023) - http: allow longer HTTP/2 request method names - Increase the maximum request method name length from 11 to 23. For HTTP/1.1 and earlier there's not a specific limit in libcurl for method length except that it is limited by the initial HTTP request limit (DYN_HTTP_REQUEST). Prior to fc2f1e54 HTTP/2 was treated the same and there was no specific limit. According to Internet Assigned Numbers Authority (IANA) the longest registered method is UPDATEREDIRECTREF which is 17 characters. Also there are unregistered methods used by some companies that are longer than 11 characters. The limit was originally added by 61f52a97 but not used until fc2f1e54. Ref: https://www.iana.org/assignments/http-methods/http-methods.xhtml Closes https://github.com/curl/curl/pull/12311 Jay Satiro (12 Nov 2023) - CURLOPT_CAINFO_BLOB.3: explain what CURL_BLOB_COPY does - Add an explanation of the CURL_BLOB_COPY flag to CURLOPT_CAINFO_BLOB and CURLOPT_PROXY_CAINFO_BLOB docs. All the other _BLOB option docs already have the same explanation. Closes https://github.com/curl/curl/pull/12277 Viktor Szakats (11 Nov 2023) - tidy-up: dedupe Windows system libs in cmake Reviewed-by: Daniel Stenberg Closes #12307 Junho Choi (11 Nov 2023) - ci: test with latest quiche release (0.19.0) Closes #12180 - quiche: use quiche_conn_peer_transport_params() In recent quiche, transport parameter API is separated with quiche_conn_peer_transport_params(). (https://github.com/cloudflare/quiche/pull/1575) It breaks with bulding with latest(post 0.18.0) quiche. Closes #12180 Daniel Stenberg (11 Nov 2023) - Makefile: generate the VC 14.20 project files at dist-time Follow-up to 28287092cc5a6d6ef8 (#12282) Closes #12290 Sam James (11 Nov 2023) - misc: fix -Walloc-size warnings GCC 14 introduces a new -Walloc-size included in -Wextra which gives: ``` src/tool_operate.c: In function ‘add_per_transfer’: src/tool_operate.c:213:5: warning: allocation of insufficient size ‘1’ fo r type ‘struct per_transfer’ with size ‘480’ [-Walloc-size] 213 | p = calloc(sizeof(struct per_transfer), 1); | ^ src/var.c: In function ‘addvariable’: src/var.c:361:5: warning: allocation of insufficient size ‘1’ for type struct var’ with size ‘32’ [-Walloc-size] 361 | p = calloc(sizeof(struct var), 1); | ^ ``` The calloc prototype is: ``` void *calloc(size_t nmemb, size_t size); ``` So, just swap the number of members and size arguments to match the prototype, as we're initialising 1 struct of size `sizeof(struct ...)`. GCC then sees we're not doing anything wrong. Closes #12292 Mark Gaiser (11 Nov 2023) - IPFS: bugfixes - Fixed endianness bug in gateway file parsing - Use IPFS_PATH in tests where IPFS_DATA was used - Fixed typos from traling -> trailing - Fixed broken link in IPFS.md Follow-up to 859e88f6533f9e Reported-by: Michael Kaufmann Bug: https://github.com/curl/curl/pull/12152#issuecomment-1798214137 Closes #12305 Daniel Stenberg (11 Nov 2023) - VULN-DISCLOSURE-POLIC: remove broken link to hackerone It should ideally soon not be done from hackerone anyway Closes #12308 Andrew Kurushin (11 Nov 2023) - schannel: add CA cache support for files and memory blobs - Support CA bundle and blob caching. Cache timeout is 24 hours or can be set via CURLOPT_CA_CACHE_TIMEOUT. Closes https://github.com/curl/curl/pull/12261 Daniel Stenberg (10 Nov 2023) - RELEASE-NOTES: synced Charlie C (10 Nov 2023) - cmake: option to disable install & drop `curlu` target when unused This patch makes the following changes: - adds the option `CURL_DISABLE_INSTALL` - to disable 'install' targets. - Removes the target `curlu` when the option `BUILD_TESTING` is set to `OFF` - to prevent it from being loaded in Visual Studio. Closes #12287 Kai Pastor (10 Nov 2023) - cmake: fix multiple include of CURL package Fixes errors on second `find_package(CURL)`. This is a frequent case with transitive dependencies: ``` CMake Error at ...: add_library cannot create ALIAS target "CURL::libcurl" because another target with the same name already exists. ``` Test to reproduce: ```cmake cmake_minimum_required(VERSION 3.27) # must be 3.18 or higher project(curl) set(CURL_DIR "example/lib/cmake/CURL/") find_package(CURL CONFIG REQUIRED) find_package(CURL CONFIG REQUIRED) # fails add_executable(main main.c) target_link_libraries(main CURL::libcurl) ``` Ref: https://cmake.org/cmake/help/latest/release/3.18.html#other-changes Ref: https://cmake.org/cmake/help/v3.18/policy/CMP0107.html Ref: #12300 Assisted-by: Harry Mallon Closes #11913 Viktor Szakats (8 Nov 2023) - tidy-up: use `OPENSSL_VERSION_NUMBER` Uniformly use `OPENSSL_VERSION_NUMBER` to check for OpenSSL version. Before this patch some places used `OPENSSL_VERSION_MAJOR`. Also fix `lib/md4.c`, which included `opensslconf.h`, but that doesn't define any version number in these implementations: BoringSSL, AWS-LC, LibreSSL, wolfSSL. (Only in mainline OpenSSL/quictls). Switch that to `opensslv.h`. This wasn't causing a deeper problem because the code is looking for v3, which is only provided by OpenSSL/quictls as of now. According to https://github.com/openssl/openssl/issues/17517, the macro `OPENSSL_VERSION_NUMBER` is safe to use and not deprecated. Reviewed-by: Marcel Raad Closes #12298 Daniel Stenberg (8 Nov 2023) - resolve.d: drop a multi use-sentence Since the `multi:` keyword adds that message. Reported-by: 積丹尼 Dan Jacobson Fixes https://github.com/curl/curl/discussions/12294 Closes #12295 - content_encoding: make Curl_all_content_encodings allocless - Fixes a memory leak pointed out by Coverity - Also found by OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail? id=63947 - Avoids unncessary allocations Follow-up ad051e1cbec68b2456a22661b Closes #12289 Michael Kaufmann (7 Nov 2023) - vtls: use ALPN "http/1.1" for HTTP/1.x, including HTTP/1.0 Some servers don't support the ALPN protocol "http/1.0" (e.g. IIS 10), avoid it and use "http/1.1" instead. This reverts commit df856cb5c9 (#10183). Fixes #12259 Closes #12285 Daniel Stenberg (7 Nov 2023) - Makefile.am: drop vc10, vc11 and vc12 projects from dist They are end of life products. Support for generating them remain in the repo for a while but this change drops them from distribution. Closes #12288 David Suter (7 Nov 2023) - projects: add VC14.20 project files Windows projects included VC14, VC14.10, VC14.30 but not VC14.20. OpenSSL and Wolf SSL scripts mention VC14.20 so I don't see a reason why this is missing. Updated the templates to produce a VC14.20 project. Project opens in Visual Studio 2019 as expected. Closes #12282 Daniel Stenberg (7 Nov 2023) - curl: move IPFS code into src/tool_ipfs.[ch] - convert ensure_trailing into ensure_trailing_slash - strdup the URL string to own it proper - use shorter variable names - combine some expressions - simplify error handling in ipfs_gateway() - add MAX_GATEWAY_URL_LEN + proper bailout if maximum is reached - ipfs-gateway.d polish and simplification - shorten ipfs error message + make them "synthetic" Closes #12281 Viktor Szakats (6 Nov 2023) - build: delete support bits for obsolete Windows compilers - Pelles C: Unclear status, failed to obtain a fresh copy a few months ago. Possible website is HTTP-only. ~10 years ago I left this compiler dealing with crashes and other issues with no response on the forum for years. It has seen some activity in curl back in 2021. - LCC: Last stable release in September 2002. - Salford C: Misses winsock2 support, possibly abandoned? Last mentioned in 2006. - Borland C++: We dropped Borland C++ support in 2018. - MS Visual C++ 6.0: Released in 1998. curl already requires VS 2010 (or possibly 2008) as a minimum. Closes #12222 - build: delete `HAVE_STDINT_H` and `HAVE_INTTYPES_H` We use `stdint.h` unconditionally in all places except one. These uses are imposed by external dependencies / features. nghttp2, quic, wolfSSL and `HAVE_MACH_ABSOLUTE_TIME` do require this C99 header. It means that any of these features make curl require a C99 compiler. (In case of MSVC, this means Visual Studio 2010 or newer.) This patch changes the single use of `stdint.h` guarded by `HAVE_STDINT_H` to use `stdint.h` unconditionally. Also stop using `inttypes.h` as an alternative there. `HAVE_INTTYPES_H` wasn't used anywhere else, allowing to delete this feature check as well. Closes #12275 Daniel Stenberg (6 Nov 2023) - tool_operate: do not mix memory models Make sure 'inputpath' only points to memory allocated by libcurl so that curl_free works correctly. Pointed out by Coverity Follow-up to 859e88f6533f9e1f890 Closes #12280 Stefan Eissing (6 Nov 2023) - lib: client writer, part 2, accounting + logging This PR has these changes: Renaming of unencode_* to cwriter, e.g. client writers - documentation of sendf.h functions - move max decode stack checks back to content_encoding.c - define writer phase which was used as order before - introduce phases for monitoring inbetween decode phases - offering default implementations for init/write/close Add type paramter to client writer's do_write() - always pass all writes through the writer stack - writers who only care about BODY data will pass other writes unchanged add RAW and PROTOCOL client writers - RAW used for Curl_debug() logging of CURLINFO_DATA_IN - PROTOCOL used for updates to data->req.bytecount, max_filesize checks and Curl_pgrsSetDownloadCounter() - remove all updates of data->req.bytecount and calls to Curl_pgrsSetDownloadCounter() and Curl_debug() from other code - adjust test457 expected output to no longer see the excess write Closes #12184 Daniel Stenberg (6 Nov 2023) - VULN-DISCLOSURE-POLICY: escape sequences are not a security flaw Closes #12278 Viktor Szakats (6 Nov 2023) - rand: fix build error with autotools + LibreSSL autotools unexpectedly detects `arc4random` because it is also looking into dependency libs. One dependency, LibreSSL, happens to publish an `arc4random` function (via its shared lib before v3.7, also via static lib as of v3.8.2). When trying to use this function in `lib/rand.c`, its protoype is missing. To fix that, curl included a prototype, but that used a C99 type without including `stdint.h`, causing: ``` ../../lib/rand.c:37:1: error: unknown type name 'uint32_t' 37 | uint32_t arc4random(void); | ^ 1 error generated. ``` This patch improves this by dropping the local prototype and instead limiting `arc4random` use for non-OpenSSL builds. OpenSSL builds provide their own random source anyway. The better fix would be to teach autotools to not link dependency libs while detecting `arc4random`. LibreSSL publishing a non-namespaced `arc4random` tracked here: https://github.com/libressl/portable/issues/928 Regression from 755ddbe901cd0c921fbc3ac5b3775c0dc683bc73 #10672 Reviewed-by: Daniel Stenberg Fixes #12257 Closes #12274 Daniel Stenberg (5 Nov 2023) - RELEASE-NOTES: synced - strdup: do Curl_strndup without strncpy To avoid (false positive) gcc-13 compiler warnings. Follow-up to 4855debd8a2c1cb Assisted-by: Jay Satiro Reported-by: Viktor Szakats Fixes #12258 Enno Boland (5 Nov 2023) - HTTP: fix empty-body warning This change fixes a compiler warning with gcc-12.2.0 when `-DCURL_DISABLE_BEARER_AUTH=ON` is used. /home/tox/src/curl/lib/http.c: In function 'Curl_http_input_auth': /home/tox/src/curl/lib/http.c:1147:12: warning: suggest braces around emp ty body in an 'else' statement [-Wempty-body] 1147 | ; | ^ Closes #12262 Daniel Stenberg (5 Nov 2023) - openssl: identify the "quictls" backend correctly Since vanilla OpenSSL does not support the QUIC API I think it helps users to identify the correct OpenSSL fork in version output. The best (crude) way to do that right now seems to be to check if ngtcp2 support is enabled. Closes #12270 Mark Gaiser (5 Nov 2023) - curl: improved IPFS and IPNS URL support Previously just ipfs:// and ipns:// was supported, which is too strict for some usecases. This patch allows paths and query arguments to be used too. Making this work according to normal http semantics: ipfs:///foo/bar?key=val ipns:///foo/bar?key=val The gateway url support is changed. It now only supports gateways in the form of: http:///foo/bar http:// Query arguments here are explicitly not allowed and trigger an intended malformed url error. There also was a crash when IPFS_PATH was set with a non trailing forward slash. This has been fixed. Lastly, a load of test cases have been added to verify the above. Reported-by: Steven Allen Fixes #12148 Closes #12152 Harry Mallon (5 Nov 2023) - docs: KNOWN_BUGS cleanup * Remove other mention of hyper memory-leaks from `KNOWN_BUGS`. Should have been removed in 629723ecf22a8eae78d64cceec2f3bdae703ec95 * Remove mention of aws-sigv4 sort query string from `KNOWN_BUGS`. Fixed in #11806 * Remove mention of aws-sigv4 query empty value problems * Remove mention of aws-sigv4 missing amz-content-sha256 Fixed in #9995 - http_aws_sigv4: canonicalise valueless query params Fixes #8107 Closes #12244 Michael Kaufmann (4 Nov 2023) - docs: preserve the modification date when copying the prebuilt man page The previously built man page "curl.1" must be copied with the original modification date, otherwise the man page is never updated. This fixes a bug that has been introduced with commit 2568441cab. Reviewed-by: Dan Fandrich Reviewed-by: Daniel Stenberg Closes #12199 Daniel Stenberg (4 Nov 2023) - docs: remove bold from some man page SYNOPSIS sections In the name of consistency Closes #12267 - openssl: two multi pointer checks should probably rather be asserts ... so add the asserts now and consider removing the dynamic checks in a future. Ref: #12261 Closes #12264 boilingoden (4 Nov 2023) - docs: add supported version for the json write-out xref: https://curl.se/changes.html#7_70_0 Closes #12266 Viktor Szakats (3 Nov 2023) - appveyor: make VS2008-built curl tool runnable By linking the CRT statically. This avoids the error about missing runtime DLL `MSVCR90.dll` when running the freshly built `curl.exe`. Closes #12263 Stefan Eissing (3 Nov 2023) - url: proxy ssl connection reuse fix - tunnel https proxy used for http: transfers does no check if proxy-ssl configuration matches - test cases added, test_10_12 fails on 8.4.0 Closes #12255 Jay Satiro (3 Nov 2023) - curl_sspi: support more revocation error names in error messages - Add these revocation errors to sspi error list: CRYPT_E_NO_REVOCATION_DLL, CRYPT_E_NO_REVOCATION_CHECK, CRYPT_E_REVOCATION_OFFLINE and CRYPT_E_NOT_IN_REVOCATION_DATABASE. Prior to this change those error codes were not matched to their macro name and instead shown as "unknown error". Before: schannel: next InitializeSecurityContext failed: Unknown error (0x80092013) - The revocation function was unable to check revocation because the revocation server was offline. After: schannel: next InitializeSecurityContext failed: CRYPT_E_REVOCATION_OFFLINE (0x80092013) - The revocation function was unable to check revocation because the revocation server was offline. Bug: https://github.com/curl/curl/issues/12239 Reported-by: Niracler Li Closes https://github.com/curl/curl/pull/12241 - strdup: don't allow Curl_strndup to read past a null terminator - Use malloc + strncpy instead of Curl_memdup to dupe the string before null terminating it. Prior to this change if Curl_strndup was passed a length longer than the allocated string then it could copy out of bounds. This change is for posterity. Curl_strndup was added in the parent commit and currently none of the calls to it pass a length that would cause it to read past the allocated length of the input. Follow-up to d3b3ba35. Closes https://github.com/curl/curl/pull/12254 Daniel Stenberg (2 Nov 2023) - lib: add and use Curl_strndup() The Curl_strndup() function is similar to memdup(), but copies 'n' bytes then adds a terminating null byte ('\0'). Closes #12251 - CURPOST_POSTFIELDS.3: add CURLOPT_COPYPOSTFIELDS in SEE ALSO Stefan Eissing (2 Nov 2023) - pytest: use lower count in repeat tests - lower large iteration counts in some tests somewhat for the same coverage with less duration Closes #12248 Daniel Stenberg (2 Nov 2023) - RELEASE-NOTES: synced - docs: clarify that curl passes on input unfiltered ... for several options. Reported-by: Ophir Lojkine Closes #12249 - urlapi: when URL encoding the fragment, pass in the right length A benign bug because it would only add an extra null terminator. Made lib1560 get a test that runs this code. Closes #12250 Stefan Eissing (2 Nov 2023) - vtls: late clone of connection ssl config - perform connection cache matching against `data->set.ssl.primary` and proxy counterpart - fully clone connection ssl config only when connection is used Closes #12237 - msh3: error when built with CURL_DISABLE_SOCKETPAIR set Reported-by: Gisle Vanem Closes #12252 Fixes #12213 Daniel Stenberg (2 Nov 2023) - hsts: skip single-dot hostname Reported-by: Maksymilian Arciemowicz Closes #12247 - vtls: fix build without proxy Follow-up to bf0e278a3c54bc7fee7360da17c closes #12243 - docs/example/keepalive.c: show TCP keep-alive options Closes #12242 - lib1560: verify appending blank URL encoded query string - urlapi: skip appending NULL pointer query Reported-by: kirbyn17 on hackerone Closes #12240 - lib1560: verify setting host to "" with and without URL encode - urlapi: avoid null deref if setting blank host to url encode Reported-by: kirbyn17 on hackerone Closes #12240 - dynbuf: assert for NULL pointer inputs Help us catch more mistakes. Closes #12238 - HTTP3: ngtcp2 builds are no longer experimental The other HTTP/3 backends are still experimental. Closes #12235 Stefan Eissing (31 Oct 2023) - vtls: cleanup SSL config management - remove `Curl_ssl_get_config()`, no longer needed Closes #12204 Daniel Stenberg (31 Oct 2023) - libcurl-thread.3: simplify the TLS section All TLS libraries curl can use are threadsafe since OpenSSL 1.1.x, August 2016. Closes #12233 - configure: better --disable-http - disable HTTPS-proxy as well, since it can't work without HTTP - curl_setup: when HTTP is disabled, also disable all features that are HTTP-only - version: HTTPS-proxy only exists if HTTP support exists Closes #12223 - http: consider resume with CURLOPT_FAILONERRROR and 416 to be fine Finding a 'Content-Range:' in the response changed the handling. Add test case 1475 to verify -C - with 416 and Content-Range: header, which is almost exactly like test 194 which instead uses a fixed -C offset. Adjusted test 194 to also be considered fine. Fixes #10521 Reported-by: Smackd0wn Fixes #12174 Reported-by: Anubhav Rai Closes #12176 Stefan Eissing (30 Oct 2023) - GHA: fix checkout of quictls repository to use correct branch name Follow-up to c868b0e30f10cd0ac7 Closes #12232 Daniel Stenberg (30 Oct 2023) - docs/example/localport.c: show off CURLOPT_LOCALPORT Closes #12230 - docs/examples/interface.c: show CURLOPT_INTERFACE use Although super simple. Closes #12229 Viktor Szakats (30 Oct 2023) - build: fix compiler warning with auths disabled ``` ./curl/lib/http.c:979:12: warning: unused function 'is_valid_auth_separator' [-Wunused-function] static int is_valid_auth_separator(char ch) ^ 5 warnings generated. ``` Follow-up to e92edfbef64448ef461117769881f3ed776dec4e #11490 Closes #12227 - build: require Windows XP or newer After this patch we assume availability of `getaddrinfo` and `freeaddrinfo`, first introduced in Windows XP. Meaning curl now requires building for Windows XP as a minimum. TODO: assume these also in autotools. Ref: https://github.com/curl/curl/pull/12221#issuecomment-1783761806 Closes #12225 - appveyor: bump one job to OpenSSL 3.1 (was 1.1.1) Use 3.1 with the modern runner image. We still use 1.1.1 in 8 jobs. 1.1.1 is EOL since 2023-09-11: https://www.openssl.org/blog/blog/2023/03/28/1.1.1-EOL/ Also: - add missing SSL-backend to job descriptions. - tidy up CPU in job descriptions. Closes #12226 Daniel Stenberg (30 Oct 2023) - RELEASE-NOTES: synced - GHA: bump ngtcp2, nghttp3, nghttp2 and quictls versions ngtcp2 1.0.1 nghttp3 1.0.0 nghttp2 1.58.0 quictls 3.1.4+quic also sync HTTP3.md with these changes Closes #12132 Kareem (29 Oct 2023) - wolfssl: add default case for wolfssl_connect_step1 switch Closes #12218 Jay Satiro (29 Oct 2023) - curl_setup: disallow Windows IPv6 builds missing getaddrinfo - On Windows if IPv6 is enabled but getaddrinfo is missing then #error the build. curl can be built with IPv6 support (ENABLE_IPV6) but without the ability to resolve hosts to IPv6 addresses (HAVE_GETADDRINFO). On Windows this is highly unlikely and should be considered a bad build configuration. Such a bad configuration has already given us a bug that was hard to diagnose. See #12134 and #12136 for discussion. Ref: https://github.com/curl/curl/issues/12134 Ref: https://github.com/curl/curl/pull/12136 Closes https://github.com/curl/curl/pull/12221 Nico Rieck (29 Oct 2023) - openssl: make CURLSSLOPT_NATIVE_CA import Windows intermediate CAs - If CURLSSLOPT_NATIVE_CA on Windows then import from intermediate CA "CA" store after importing from root CA "ROOT" store. This change allows curl to work in situations where a server does not send all intermediate certs and they are present in the "CA" store (the store with intermediate CAs). This is already allowed by the Schannel backend. Also this change makes partial chain verification possible for those certs since we allow partial chain verification by default for OpenSSL (unless CURLSSLOPT_NO_PARTIALCHAIN). This is not allowed by the Schannel backend. Prior to this change CURLSSLOPT_NATIVE_CA only imported "ROOT" certs. Fixes https://github.com/curl/curl/issues/12155 Closes https://github.com/curl/curl/pull/12185 Viktor Szakats (28 Oct 2023) - Makefile.mk: fix `-rtmp` option for non-Windows [ci skip] Daniel Stenberg (28 Oct 2023) - asyn-ares: handle no connection in the addrinfo callback To avoid crashing. Follow-up from 56a4db2 Closes #12219 Jay Satiro (28 Oct 2023) - hostip6: fix DEBUG_ADDRINFO builds - Removed unused and incorrect parameter from dump_addrinfo(). Bug: https://github.com/curl/curl/commit/56a4db2e#commitcomment-131050442 Reported-by: Gisle Vanem Closes https://github.com/curl/curl/pull/12212 Viktor Szakats (28 Oct 2023) - Makefile.mk: restore `_mingw.h` for default `_WIN32_WINNT` In 8.4.0 we deleted `_mingw.h` as part of purging old-mingw support. Turns out `_mingw.h` had the side-effect of setting a default `_WIN32_WINNT` value expected by `lib/config-win32.h` to enable `getaddrinfo` support in `Makefile.mk` mingw-w64 builds. This caused disabling support for this unless specifying the value manually. Restore this header and update its comment to tell why we continue to need it. This triggered a regression in official Windows curl builds starting with 8.4.0_1. Fixed in 8.4.0_6. (8.5.0 will be using CMake.) Regression from 38029101e2d78ba125732b3bab6ec267b80a0e72 #11625 Reported-by: zhengqwe on github Helped-by: Nico Rieck Fixes #12134 Fixes #12136 Closes #12217 - hostip: silence compiler warning `-Wparentheses-equality` Seen with LLVM 17. ``` hostip.c:1336:22: warning: equality comparison with extraneous parentheses [- Wparentheses-equality] 1336 | (a->ai_family == PF_INET)) { | ~~~~~~~~~~~~~^~~~~~~~~~ hostip.c:1336:22: note: remove extraneous parentheses around the comparison t o silence this warning 1336 | (a->ai_family == PF_INET)) { | ~ ^ ~ hostip.c:1336:22: note: use '=' to turn this equality comparison into an assi gnment 1336 | (a->ai_family == PF_INET)) { | ^~ | = 1 warning generated. ``` Follow-up to b651aba0962bb31353f55de4dc35f745952a1b10 #12145 Reviewed-by: Daniel Stenberg Closes #12215 Stefan Eissing (27 Oct 2023) - doh: use PIPEWAIT when HTTP/2 is attempted Closes #12214 Daniel Stenberg (27 Oct 2023) - setopt: remove outdated cookie comment Closes #12206 Stefan Eissing (27 Oct 2023) - cfilter: provide call to tell connection to forget a socket - fixed libssh.c workaround for a socket being closed by the library - eliminate the terrible hack in cf-socket.c to guess when this happened and try not closing the socket again. - fixes race in eyeballing when socket could have failed to be closed for a discarded connect attempt Closes #12207 - url: protocol handler lookup tidy-up - rename lookup to what it does - use ARRAYSIZE instead of NULL check for end - offer alternate lookup for 0-terminated strings Closes #12216 Viktor Szakats (27 Oct 2023) - build: variadic macro tidy-ups - delete unused `HAVE_VARIADIC_MACROS_C99/GCC` feature checks. (both autotools and CMake.) - delete duplicate `NULL` check in `Curl_trc_cf_infof()`. - fix compiler warning in `CURL_DISABLE_VERBOSE_STRINGS` builds. ``` ./lib/cf-socket.c:122:41: warning: unused parameter 'data' [-Wunused-parame ter] static void nosigpipe(struct Curl_easy *data, ^ ``` - fix `#ifdef` comments in `lib/curl_trc.{c,h}`. - fix indentation in some `infof()` calls. Follow-up to dac293cfb7026b1ca4175d88b80f1432d3d3c684 #12167 Cherry-picked from #12105 Closes #12210 - cmake: speed up threads setup for Windows Win32 threads are always available. We enabled them unconditionally (with `ENABLE_THREADED_RESOLVER`). CMake built-in thread detection logic has this condition hard-coded for Windows as well (since at least 2007). Instead of doing all the work of detecting pthread combinations on Windows, then discarding those results, skip these efforts and assume built-in thread support when building for Windows. This saves 1-3 slow CMake configuration steps. Reviewed-by: Daniel Stenberg Closes #12202 - cmake: speed up zstd detection Before this patch we detected the presence of a specific zstd API to see if we can use the library. zstd published that API in its first stable release: v1.0.0 (2016-08-31). Replace that method by detecting the zstd library version instead and accepting if it's v1.0.0 or newer. Also display this detected version and display a warning if the zstd found is unfit for curl. We use the same version detection method as zstd itself, via its public C header. This deviates from autotools which keeps using the slow method of looking for the API by building a test program. The outcome is the same as long as zstd keeps offering this API. Ref: https://github.com/facebook/zstd/commit/5a0c8e24395079f8e8cdc90aa1659cd5 ab1b7427 (2016-08-12, committed) Ref: https://github.com/facebook/zstd/releases/tag/v0.8.1 (2016-08-18, first released) Ref: https://github.com/facebook/zstd/releases/tag/v1.0.0 Reviewed-by: Daniel Stenberg Closes #12200 Daniel Stenberg (26 Oct 2023) - openssl: fix infof() to avoid compiler warning for %s with null vtls/openssl.c: In function ‘ossl_connect_step2’: ../lib/curl_trc.h:120:10: error: ‘%s’ directive argument is null [-Werror =format-overflow=] 120 | Curl_infof(data, __VA_ARGS__); } while(0) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ vtls/openssl.c:4008:5: note: in expansion of macro ‘infof’ 4008 | infof(data, "SSL connection using %s / %s / %s / %s", | ^~~~~ vtls/openssl.c:4008:49: note: format string is defined here 4008 | infof(data, "SSL connection using %s / %s / %s / %s", | ^~ Follow-up to b6e6d4ff8f253c8b8055bab Closes #12196 Stefan Eissing (26 Oct 2023) - lib: apache style infof and trace macros/functions - test for a simplified C99 variadic check - args to infof() in --disable-verbose are no longer disregarded but must compile. Closes #12167 Fixes #12083 Fixes #11880 Fixes #11891 Daniel Stenberg (26 Oct 2023) - RELEASE-NOTES: synced Stefan Eissing (26 Oct 2023) - urldata: move async resolver state from easy handle to connectdata - resolving is done for a connection, not for every transfer - save create/dup/free of a cares channel for each transfer - check values of setopt calls against a local channel if no connection has been attached yet, when needed. Closes #12198 Daniel Stenberg (26 Oct 2023) - CURLOPT_WRITEFUNCTION.3: clarify what libcurl returns for CURL_WRITEFUNC_ERRO R It returns CURLE_WRITE_ERROR. It was not previously stated clearly. Reported-by: enWILLYado on github Fixes #12201 Closes #12203 Viktor Szakats (25 Oct 2023) - autotools: update references to deleted `crypt-auth` option Delete leftovers of the `crypt-auth` `./configure` option and add the new ones that replaced them. Follow-up to e92edfbef64448ef461117769881f3ed776dec4e #11490 Reviewed-by: Daniel Stenberg Closes #12194 Stefan Eissing (25 Oct 2023) - lib: introduce struct easy_poll_set for poll information Connection filter had a `get_select_socks()` method, inspired by the various `getsocks` functions involved during the lifetime of a transfer. These, depending on transfer state (CONNECT/DO/DONE/ etc.), return sockets to monitor and flag if this shall be done for POLLIN and/or POLLOUT. Due to this design, sockets and flags could only be added, not removed. This led to problems in filters like HTTP/2 where flow control prohibits the sending of data until the peer increases the flow window. The general transfer loop wants to write, adds POLLOUT, the socket is writeable but no data can be written. This leads to cpu busy loops. To prevent that, HTTP/2 did set the `SEND_HOLD` flag of such a blocked transfer, so the transfer loop cedes further attempts. This works if only one such filter is involved. If a HTTP/2 transfer goes through a HTTP/2 proxy, two filters are setting/clearing this flag and may step on each other's toes. Connection filters `get_select_socks()` is replaced by `adjust_pollset()`. They get passed a `struct easy_pollset` that keeps up to `MAX_SOCKSPEREASYHANDLE` sockets and their `POLLIN|POLLOUT` flags. This struct is initialized in `multi_getsock()` by calling the various `getsocks()` implementations based on transfer state, as before. After protocol handlers/transfer loop have set the sockets and flags they want, the `easy_pollset` is *always* passed to the filters. Filters "higher" in the chain are called first, starting at the first not-yet-connection one. Each filter may add sockets and/or change flags. When all flags are removed, the socket itself is removed from the pollset. Example: * transfer wants to send, adds POLLOUT * http/2 filter has a flow control block, removes POLLOUT and adds POLLIN (it is waiting on a WINDOW_UPDATE from the server) * TLS filter is connected and changes nothing * h2-proxy filter also has a flow control block on its tunnel stream, removes POLLOUT and adds POLLIN also. * socket filter is connected and changes nothing * The resulting pollset is then mixed together with all other transfers and their pollsets, just as before. Use of `SEND_HOLD` is no longer necessary in the filters. All filters are adapted for the changed method. The handling in `multi.c` has been adjusted, but its state handling the the protocol handlers' `getsocks` method are untouched. The most affected filters are http/2, ngtcp2, quiche and h2-proxy. TLS filters needed to be adjusted for the connecting handshake read/write handling. No noticeable difference in performance was detected in local scorecard runs. Closes #11833 Daniel Stenberg (25 Oct 2023) - tests/README: SOCKS tests are not using OpenSSH, it has its own server Follow-up to 04fd67555cc Closes #12195 Jacob Hoffman-Andrews (25 Oct 2023) - tets: make test documentation more user-friendly Put the instructions to run tests right at the top of tests/README.md. Give instructions to read the runtests.1 man page for information about flags. Delete redundant copy of the flags documentation in the README. Add a mention in README.md of the important parallelism flag, to make test runs go much faster. Move documentation of output line format into the runtests.1 man page, and update it with missing flags. Fix the order of two flags in the man page. Closes #12193 Viktor Szakats (24 Oct 2023) - cmake: pre-fill rest of detection values for Windows The goal of this patch is to avoid unnecessary feature detection work when doing Windows builds with CMake. Do this by pre-filling well-known detection results for Windows and specifically for mingw-w64 and MSVC compilers. Also limit feature checks to platforms where the results are actually used. Drop a few redundant ones. And some tidying up. - pre-fill remaining detection values in Windows CMake builds. Based on actual detection results observed in CI runs, preceding similar work over libssh2 and matching up values with `lib/config-win32.h`. This brings down CMake configuration time from 58 to 14 seconds on the same local machine. On AppVeyor CI this translates to: - 128 seconds -> 50 seconds VS2022 MSVC with OpenSSL (per CMake job): https://ci.appveyor.com/project/curlorg/curl/builds/48208419/job/4gw66ecr jpy7necb#L296 https://ci.appveyor.com/project/curlorg/curl/builds/48217440/job/8m4fwrr2 fe249uo8#L186 - 62 seconds -> 16 seconds VS2017 MINGW (per CMake job): https://ci.appveyor.com/project/curlorg/curl/builds/48208419/job/s1y8q5iv lcs7ub29?fullLog=true#L290 https://ci.appveyor.com/project/curlorg/curl/builds/48217440/job/pchpxyjs yc9kl13a?fullLog=true#L194 The formula is about 1-3 seconds delay for each detection. Almost all of these trigger a full compile-link cycle behind the scenes, slow even today, both cross and native, mingw-w64 and apparently MSVC too. Enabling .map files or other custom build features slows it down further. (Similar is expected for autotools configure.) - stop detecting `idn2.h` if idn2 was deselected. autotools does this. - stop detecting `idn2.h` if idn2 was not found. This deviates from autotools. Source code requires both header and lib, so this is still correct, but faster. - limit `ADDRESS_FAMILY` detection to Windows. - normalize `HAVE_WIN32_WINNT` value to lowercase `0x0a12` format. - pre-fill `HAVE_WIN32_WINNT`-dependent detection results. Saving 4 (slow) feature-detections in most builds: `getaddrinfo`, `freeaddrinfo`, `inet_ntop`, `inet_pton` - fix pre-filled `HAVE_SYS_TIME_H`, `HAVE_SYS_PARAM_H`, `HAVE_GETTIMEOFDAY` for mingw-w64. Luckily this do not change build results, as `WIN32` took priority over `HAVE_GETTIMEOFDAY` with the current source code. - limit `HAVE_CLOCK_GETTIME_MONOTONIC_RAW` and `HAVE_CLOCK_GETTIME_MONOTONIC` detections to non-Windows. We're not using these in the source code for Windows. - reduce compiler warning noise in CMake internal logs: - fix to include `winsock2.h` before `windows.h`. Apply it to autotools test snippets too. - delete previous `-D_WINSOCKAPI_=` hack that aimed to fix the above. - cleanup `CMake/CurlTests.c` to emit less warnings. - delete redundant `HAVE_MACRO_SIGSETJMP` feature check. It was the same check as `HAVE_SIGSETJMP`. - delete 'experimental' marking from `CURL_USE_OPENSSL`. - show CMake version via `CMakeLists.txt`. Credit to the `zlib-ng` project for the idea: https://github.com/zlib-ng/zlib-ng/blob/61e181c8ae93dbf56040336179c9954078b d1399/CMakeLists.txt#L7 - make `CMake/CurlTests.c` pass `checksrc`. - `CMake/WindowsCache.cmake` tidy-ups. - replace `WIN32` guard with `_WIN32` in `CMake/CurlTests.c`. Closes #12044 Jay Satiro (24 Oct 2023) - page-footer: clarify exit code 25 - Clarify that curl tool exit code 25 means an upload failed to start. Exit code 25 is equivalent to CURLE_UPLOAD_FAILED (25). Prior to this change the documentation only mentioned the case of FTP STOR failing. Reported-by: Emanuele Torre Ref: https://github.com/curl/curl/blob/curl-8_4_0/docs/libcurl/libcurl-errors .3#L113-L115 Fixes https://github.com/curl/curl/issues/12189 Closes https://github.com/curl/curl/pull/12190 Daniel Stenberg (24 Oct 2023) - scripts/cijobs.pl: adjust for appveyor Follow-up to a1d73a6bb Alex Bozarth (24 Oct 2023) - OpenSSL: Include SIG and KEM algorithms in verbose Currently the verbose output does not include which algorithms are used for the signature and key exchange when using OpenSSL. Including the algorithms used will enable better debugging when working on using new algorithm implementations. Know what algorithms are used has become more important with the fast growing research into new quantum-safe algorithms. This implementation includes a build time check for the OpenSSL version to use a new function that will be included in OpenSSL 3.2 that was introduced in openssl/openssl@6866824 Based-on-patch-by: Martin Schmatz Closes #12030 Daniel Stenberg (23 Oct 2023) - http2: provide an error callback and failf the message Getting nghttp2's error message helps users understand what's going on. For example when the connection is brought down due a forbidden header is used - as that header is then not displayed by curl itself. Example: curl: (92) Invalid HTTP header field was received: frame type: 1, stream: 1, name: [upgrade], value: [h2,h2c] Ref: #12172 Closes #12179 Turiiya (23 Oct 2023) - BINDINGS: add V binding Closes #12182 Daniel Stenberg (22 Oct 2023) - configure: check for the fseeko declaration too ... and make the code require both symbol and declaration. This is because for Android, the symbol is always present in the lib at build-time even when not actually available in run-time. Assisted-by: Viktor Szakats Reported-by: 12932 on github Fixes #12086 Closes #12158 Viktor Szakats (22 Oct 2023) - cmake: fix OpenSSL quic detection in quiche builds An orphan call to `CheckQuicSupportInOpenSSL()` remained after a recent update when checking QUIC for quiche. Move back QUIC detection to a function and fixup callers to use that. Also make sure that quiche gets QUIC from BoringSSL, because it doesn't support other forks at this time. Regression from dee310d54261f9a8416e87d50bccfe2cbe404949 #11555 Reported-by: Casey Bodley Fixes #12160 Closes #12162 Daniel Stenberg (22 Oct 2023) - RELEASE-NOTES: synced bump to 8.5.0 for pending release Dan Fandrich (21 Oct 2023) - test3103: add missing quotes around a test tag attribute Loïc Yhuel (21 Oct 2023) - tool: fix --capath when proxy support is disabled After 95e8515ca0, --capath always sets CURLOPT_PROXY_CAPATH, which fails with CURLE_UNKNOWN_OPTION when proxy support is disabled. Closes #12089 Daniel Stenberg (21 Oct 2023) - openldap: move the alloc of ldapconninfo to *connect() Fixes a minor memory leak on LDAP connection reuse. Doing the allocation already in *setup_connection() is wrong since that connect struct might get discarded early when an existing connection is reused instead. Closes #12166 - openldap: set the callback argument in oldap_do ... to make sure it has the current 'data' pointer and not a stale old one. Reported-by: Dan Fandrich Closes #12166 - gnutls: support CURLSSLOPT_NATIVE_CA Remove the CURL_CA_FALLBACK logic. That build option was added to allow primarily OpenSSL to use the default paths for loading the CA certs. For GnuTLS it was instead made to load the "system certs", which is different and not desirable. The native CA store loading is now asked for with this option. Follow-up to 7b55279d1d856 Co-authored-by: Jay Satiro Closes #12137 Stefan Eissing (21 Oct 2023) - RTSP: improved RTP parser - fix HTTP header parsing to report incomplete lines it buffers as consumed! - re-implement the RTP parser for interleave RTP messages for robustness. It is now keeping its state at the connection - RTSP protocol handler "readwrite" implementation now tracks if the response is before/in/after header parsing or "in" a bod by calling "Curl_http_readwrite_headers()" itself. This allows it to know when non-RTP bytes are "junk" or HEADER or BODY. - tested with #12035 and various small receive sizes where current master fails Closes #12052 - http2: header conversion tightening - fold the code to convert dynhds to the nghttp2 structs into a dynhds internal method - saves code duplication - pacifies compiler analyzers Closes #12097 Daniel Stenberg (21 Oct 2023) - curl_ntlm_wb: fix elif typo Reported-by: Manfred Schwarb Follow-up to d4314cdf65ae Bug: https://github.com/curl/curl/commit/d4314cdf65aee295db627016934bd9eb621a b077#r130551295 Dan Fandrich (20 Oct 2023) - test1683: remove commented-out check alternatives Python precheck/postcheck alternatives were included but commented out. Since these are not used and perl is guaranteed to be available to run the perl versions anyway, the Python ones are removed. Daniel Stenberg (20 Oct 2023) - hostip: show the list of IPs when resolving is done Getting 'curl.se' today then gets this verbose output which might help debugging connectivity related matters. * Host curl.se:80 was resolved. * IPv6: 2a04:4e42::347, 2a04:4e42:200::347, 2a04:4e42:400::347, 2a04:4e42:600::347, 2a04:4e42:800::347, 2a04:4e42:a00::347, 2a04:4e42:c00::347, 2a04:4e42:e00::347 * IPv4: 151.101.193.91, 151.101.1.91, 151.101.65.91, 151.101.129.91 Co-authored-by: Jay Satiro Closes #12145 rilysh (20 Oct 2023) - docs: fix function typo in curl_easy_option_next.3 Closes #12170 Daniel Stenberg (20 Oct 2023) - vssh: remove the #ifdef for Curl_ssh_init, use empty macro In the same style as other init calls - easy: remove duplicate wolfSSH init call It is already done in Curl_ssh_init() where it belongs. Closes #12168 - socks: make SOCKS5 use the CURLOPT_IPRESOLVE choice Fixes #11949 Reported-by: Ammar Faizi Closes #12163 - urldata: move the 'internal' boolean to the state struct ... where all the other state bits for the easy handles live. Closes #12165 - url: don't touch the multi handle when closing internal handles Reported-by: Maksymilian Arciemowicz Closes #12165 Faraz Fallahi (19 Oct 2023) - getenv: PlayStation doesn't have getenv() Closes #12140 Daniel Stenberg (19 Oct 2023) - transfer: only reset the FTP wildcard engine in CLEAR state To avoid the state machine to start over and redownload all the files *again*. Reported-by: lkordos on github Regression from 843b3baa3e3cb228 (shipped in 8.1.0) Bisect-by: Dan Fandrich Fixes #11775 Closes #12156 Stefan Eissing (19 Oct 2023) - GHA: move mod_h2 version in CI to v2.0.25 Closes #12157 Daniel Stenberg (19 Oct 2023) - ntlm_wb: use pipe instead of socketpair when possible Closes #12149 - RELEASE-NOTES: synced - asyn-thread: use pipe instead of socketpair for IPC when available If pipe() is present. Less overhead. Helped-by: Viktor Szakats Closes #12146 Dan Fandrich (17 Oct 2023) - tests: Fix Windows test helper tool search & use it for handle64 The checkcmd() and checktestcmd() functions would not have worked on Windows due to hard-coding the UNIX PATH separator character and not adding .exe file extension. This meant that tools like stunnel, valgrind and nghttpx would not have been found and used on Windows, and inspection of previous test runs show none of those being found in pure Windows CI builds. With this fixed, they can be used to detect the handle64.exe program before attempting to use it. When handle64.exe was called unconditionally without it existing, it caused perl to abort the test run with the error The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: sh: handle64.exe: command not found Closes #12115 Daniel Stenberg (17 Oct 2023) - multi: use pipe instead of socketpair to *wakeup() If pipe() is present. Less overhead. Closes #12142 Jay Satiro (17 Oct 2023) - build: fix 'threadsafe' feature detection for older gcc - Add 'threadsafe' to the feature list shown during build if POSIX threads are being used. This is a follow-up to 5adb6000 which added support for building a thread-safe libcurl with older versions of gcc where atomic is not available but pthread is. Reported-by: Dan Fandrich Co-authored-by: Dan Fandrich Fixes https://github.com/curl/curl/issues/12125 Closes https://github.com/curl/curl/pull/12127 Daniel Stenberg (16 Oct 2023) - test729: verify socks4a with excessive proxy user name length - socks: better buffer size checks for socks4a user and hostname Also limit the proxy user name to 255 bytes, which is the same limit as in SOCKS5. Reported-by: sd0 on hackerone Closes #12139 - curl.h: on FreeBSD include sys/param.h instead of osreldate.h Should things build on Playstation as well Fixes #12107 Reported-by: Faraz Fallahi Closes #12123 Marcin Rataj (16 Oct 2023) - tool_operate: fix links in ipfs errors URL fragment links generated from headers in https://curl.se/docs/ipfs.html are lowercase. Closes #12133 Viktor Szakats (15 Oct 2023) - cmake: replace `check_library_exists_concat()` The idea of `check_library_exists_concat()` is that it detects an optional component and adds it to the list of libs that we also use in subsequent component checks. This caused problems when detecting components with unnecessary dependencies that were not yet built. CMake offers the `CMAKE_REQUIRED_LIBRARIES` variable to set libs used for component checks, which we already use in most cases. That left 4 uses of `check_library_exists_concat()`. Only one of these actually needed the 'concat' feature (ldap/lber). Delete this function and replace it with standard `check_library_exists()` and manual management of our `CURL_LIBS` list we use when linking build targets. And special logic to handle the ldap/lber case. (We have a similar function for headers: `check_include_file_concat()`. It works, but problematic for performance reasons and because it hides the actual headers required in `check_symbol_exists()` calls.) Ref: #11537 #11558 Fixes #11285 Fixes #11648 Closes #12070 LoRd_MuldeR (15 Oct 2023) - tool_cb_wrt: fix write output for very old Windows versions - Pass missing parameter for 'lpNumberOfCharsWritten' to WriteConsoleW() function. Apparently this parameter was *not* optional on older Windows versions. Issue observed on Windows XP SP2. Issue not observed on Windows 7 SP1. So at some point between those two Microsoft changed the behavior. Prior to this change, on those versions if parameter is NULL then the function call fails with error ERROR_INVALID_ACCESS. Regression since af3f4e41. Ref: https://github.com/MicrosoftDocs/Console-Docs/issues/299 Fixes https://github.com/curl/curl/issues/12131 Closes https://github.com/curl/curl/pull/12130 Jay Satiro (15 Oct 2023) - tool_urlglob: fix build for old gcc versions - Don't use __builtin_mul_overflow for GCC 4 and earlier. The function was added in GCC 5. Ref: https://gcc.gnu.org/gcc-5/changes.html Reported-by: Dan Fandrich Fixes https://github.com/curl/curl/issues/12124 Closes https://github.com/curl/curl/pull/12128 Carlos Henrique Lima Melara (14 Oct 2023) - docs/libcurl: fix three minor man page format mistakes Reported-by: Samuel Henrique Closes https://github.com/curl/curl/pull/12126 Jay Satiro (14 Oct 2023) - tests/server: add more SOCKS5 handshake error checking - Add additional checking for missing and too-short SOCKS5 handshake messages. Prior to this change the SOCKS5 test server did not check that all parts of the handshake were received successfully. If those parts were missing or too short then the server would access uninitialized memory. This issue was discovered in CI job 'memory-sanitizer' test results. Test 2055 was failing due to the SOCKS5 test server not running. It was not running because either it crashed or memory sanitizer aborted it during Test 728. Test 728 connects to the SOCKS5 test server on a redirect but does not send any data on purpose. The test server was not prepared for that. Reported-by: Dan Fandrich Fixes https://github.com/curl/curl/issues/12117 Closes https://github.com/curl/curl/pull/12118 Daniel Stenberg (14 Oct 2023) - RELEASE-NOTES: synced Sohom Datta (14 Oct 2023) - tool_getparam: limit --rate to be smaller than number of ms Currently, curl allows users to specify absurd request rates that might be higher than the number of milliseconds in the unit (ex: curl --rate 3600050/h http://localhost:8080 does not error out despite there being only 3600000ms in a hour). This change adds a conditional check before the millisecond calculation making sure that the number is not higher than the numerator (the unit) If the number is higher, curl errors out with PARAM_NUMBER_TOO_LARGE Closes #12116 Daniel Stenberg (14 Oct 2023) - opts: fix two minor man page format mistakes Jay Satiro (14 Oct 2023) - curl_trc: remove a bad assertion - Remove DEBUGASSERT that an internal handle must not have user private_data set before calling the user's debug callback. This is a follow-up to 0dc40b2a. The user can distinguish their easy handle from an internal easy handle by setting CURLOPT_PRIVATE on their easy handle. I had wrongly assumed that meant the user couldn't then set CURLOPT_PRIVATE on an internal handle as well. Bug: https://github.com/curl/curl/pull/12060#issuecomment-1754594697 Reported-by: Daniel Stenberg Closes https://github.com/curl/curl/pull/12104 Dan Fandrich (13 Oct 2023) - test613: stop showing an error on missing output file This test would show an error message if the output was missing during the log post-processing step, but the message was not captured by the test harness and wasn't useful since the normal golden log file comparison would the problem more clearly. Stefan Eissing (13 Oct 2023) - quic: manage connection idle timeouts - configure a 120s idle timeout on our side of the connection - track the timestamp when actual socket IO happens - check IO timestamp to our *and* the peer's idle timeouts in "is this connection alive" checks Reported-by: calvin2021y on github Fixes #12064 Closes #12077 Dan Fandrich (13 Oct 2023) - CI: ignore test 286 on Appveyor gcc 9 build This test fails sometimes with a super fast retry loop due to what may just be a compiler bug. The test results are ignored on the one CI job where it occurs because there seems to be nothing we can do to fix it. Fixes #12040 Closes #12106 Viktor Szakats (13 Oct 2023) - lib: fix gcc warning in printf call Do not pass NULL to printf %s. Seen with gcc 13.2.0 on Debian: ``` .../curl/lib/connect.c:696:27: warning: '%s' directive argument is null [-Wfo rmat-overflow=] ``` Ref: https://github.com/curl/curl-for-win/actions/runs/6476161689/job/1758442 6483#step:3:11104 Ref: #10284 Co-authored-by: Jay Satiro Closes #12082 Alex Klyubin (13 Oct 2023) - http2: safer invocation of populate_binsettings populate_binsettings now returns a negative value on error, instead of a huge positive value. Both places which call this function have been updated to handle this change in its contract. The way populate_binsettings had been used prior to this change the huge positive values -- due to signed->unsigned conversion of the potentially negative result of nghttp2_pack_settings_payload which returns negative values on error -- are not possible. But only because http2.c currently always provides a large enough output buffer and provides H2 SETTINGS IVs which pass the verification logic inside nghttp2. If the verification logic were to change or if http2.c started passing in more IVs without increasing the output buffer size, the overflow could become reachable, and libcurl/curl might start leaking memory contents to servers/proxies... Closes #12101 Daniel Stenberg (13 Oct 2023) - openssl: avoid BN_num_bits() NULL pointer derefs Reported-by: icy17 on github Fixes #12099 Closes #12100 - wolfssl: require WOLFSSL_SYS_CA_CERTS for loading system CA This define is set in wolfssl's options.h file when this function and feature is present. Handles both builds with the feature explicitly disabled and wolfSSL versions before 5.5.2 - which introduced this API call. Closes #12108 - tool_urlglob: make multiply() bail out on negative values - Does not work correctly with negative values - use __builtin_mul_overflow() on gcc Reported-by: Torben Dury Closes #12102 Loïc Yhuel (13 Oct 2023) - cmake: fix CURL_DISABLE_GETOPTIONS - Add CURL_DISABLE_GETOPTIONS to curl_config.h.cmake. Prior to this change the option had no effect because it was missing from that file. Closes https://github.com/curl/curl/pull/12091 - easy_lock: add a pthread_mutex_t fallback This allows to keep the init threadsafe with gcc < 4.9.0 (no C11 atomics). Closes https://github.com/curl/curl/pull/12090 Viktor Szakats (12 Oct 2023) - CI: add autotools, out-of-tree, debug build to distro check job Add a job that builds curl from a generated source tarball sample, with autotools, out-of-tree, in debug mode. Ref: #12085 Closes #12088 Daniel Stenberg (12 Oct 2023) - http: avoid Expect: 100-continue if Upgrade: is used Reported-by: Daniel Jelinski Fixes #12022 Closes #12062 Jan Alexander Steffens (heftig) (12 Oct 2023) - docs: use SOURCE_DATE_EPOCH for generated manpages This should make builds from Git reproducible. Closes #12092 Daniel Stenberg (12 Oct 2023) - RELEASE-NOTES: synced Bumped to 8.4.1 Viktor Szakats (12 Oct 2023) - cmake: fix `HAVE_H_ERRNO_ASSIGNABLE` detection Fix `HAVE_H_ERRNO_ASSIGNABLE` to not run, only compile its test snippet, aligning this with autotools. This fixes an error when doing cross-builds and also actually detects this feature. It affected systems not allowlisted into this, e.g. SerenityOS. We used this detection result to enable `HAVE_GETADDRINFO_THREADSAFE`. Follow-up to 04a3a377d83fd72c4cf7a96c9cb6d44785e33264 #11979 Ref: #12095 (closed in favour of this patch) Ref: #11964 (effort to sync cmake detections with autotools) Reported-by: Kartatz on Github Assisted-by: Kartatz on Github Fixes #12093 Closes #12094 - build: add `src/.checksrc` to source tarball Regression from e5bb88b8f824ed87620bd923552534c83c2a516e #11958 Bug: https://github.com/curl/curl/pull/11958#issuecomment-1757079071 Reported-by: Romain Geissler Fixes #12084 Closes #12085 Version 8.4.0 (11 Oct 2023) Daniel Stenberg (11 Oct 2023) - RELEASE-NOTES: synced - THANKS: add contributors from 8.4.0 Jay Satiro (11 Oct 2023) - socks: return error if hostname too long for remote resolve Prior to this change the state machine attempted to change the remote resolve to a local resolve if the hostname was longer than 255 characters. Unfortunately that did not work as intended and caused a security issue. Bug: https://curl.se/docs/CVE-2023-38545.html Stefan Eissing (10 Oct 2023) - CI: remove slowed-network tests - remove these tests as they are currently not reliable in our CI setups. curl handles the test cases, but CI sometimes fails on these due to additional conditions. Rather than mix them in, an additional CI job will be added in the future that is specific to them. Closes https://github.com/curl/curl/pull/12075 Jay Satiro (10 Oct 2023) - libcurl-env-dbg.3: move debug variables from libcurl-env.3 - Move documentation of libcurl environment variables used only in debug builds from libcurl-env into a separate document libcurl-env-dbg. - Document more debug environment variables. Previously undocumented or missing a description: CURL_ALTSVC_HTTP, CURL_DBG_SOCK_WBLOCK, CURL_DBG_SOCK_WPARTIAL, CURL_DBG_QUIC_WBLOCK, CURL_DEBUG, CURL_DEBUG_SIZE, CURL_GETHOSTNAME, CURL_HSTS_HTTP, CURL_FORCETIME, CURL_SMALLREQSEND, CURL_SMALLSENDS, CURL_TIME. Closes https://github.com/curl/curl/pull/11811 Dan Fandrich (9 Oct 2023) - test670: increase the test timeout This should make it more immune to loaded servers. Ref: #11328 Stefan Eissing (9 Oct 2023) - MQTT: improve receive of ACKs - add `mq->recvbuf` to provide buffering of incomplete ACK responses - continue ACK reading until sufficient bytes available - fixes test failures on low network receives Closes #12071 Viktor Szakats (9 Oct 2023) - quic: fix BoringSSL build Add guard around `SSL_CTX_set_ciphersuites()` use. Bug: https://github.com/curl/curl/pull/12065#issuecomment-1752171885 Follow-up to aa9a6a177017e4b74d33cdf85a3594900f4a7f81 Co-authored-by: Jay Satiro Reviewed-by: Daniel Stenberg Closes #12067 Stefan Eissing (9 Oct 2023) - test1540: improve reliability - print that bytes have been received on pausing, but not how many Closes #12069 - test2302: improve reliability - make result print collected write data, unless change in meta flags is detected - will show same result even when data arrives via several writecb invocations Closes #12068 Daniel Stenberg (9 Oct 2023) - curl_easy_pause: set "in callback" true on exit if true Because it might have called another callback in the mean time that then set the bit FALSE on exit. Reported-by: Jay Satiro Fixes #12059 Closes #12061 Viktor Szakats (8 Oct 2023) - h3: add support for ngtcp2 with AWS-LC builds ``` curl 8.4.0-DEV (x86_64-apple-darwin) libcurl/8.4.0-DEV (SecureTransport) AWS- LC/1.15.0 nghttp2/1.56.0 ngtcp2/0.19.1 nghttp3/0.15.0 Release-Date: [unreleased] Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp ws wss Features: alt-svc AsynchDNS HSTS HTTP2 HTTP3 HTTPS-proxy IPv6 Largefile Multi SSL NTLM SSL threadsafe UnixSockets ``` Also delete an obsolete GnuTLS TODO and update the header comment in `FindNGTCP2.cmake`. Reviewed-by: Daniel Stenberg Closes #12066 - build: do not publish `HAVE_BORINGSSL`, `HAVE_AWSLC` macros Syncing this up with CMake. Source code uses the built-in `OPENSSL_IS_AWSLC` and `OPENSSL_IS_BORINSSL` macros to detect BoringSSL and AWS-LC. No help is necessary from the build tools. The one use of `HAVE_BORINGSSL` in the source turned out to be no longer necessary for warning-free BoringSSL + Schannel builds. Ref: #1610 #2634 autotools detects this anyway for display purposes. CMake detects this to decide whether to use the BoringSSL-specific crypto lib with ngtcp2. It detects AWS-LC, but doesn't use the detection result just yet (planned in #12066). Ref: #11964 Reviewed-by: Daniel Stenberg Reviewed-by: Jay Satiro Closes #12065 Marc Hoersken (8 Oct 2023) - CI: move distcheck job from Azure Pipelines to GitHub Actions This will allow for more trigger excludes within Azure Pipelines. Also fixes seemingly broken check with scripts/installcheck.sh. Ref: 190374c74ec4e5247d9066544c86e8d095e1d7b5 Assisted-by: Philip Heiduck Closes #9532 Daniel Stenberg (8 Oct 2023) - url: fall back to http/https proxy env-variable if ws/wss not set Reported-by: Craig Andrews Fixes #12031 Closes #12058 Stefan Eissing (8 Oct 2023) - cf-socket: simulate slow/blocked receives in debug add 2 env variables for non-UDP sockets: 1. CURL_DBG_SOCK_RBLOCK: percentage of receive calls that randomly should return EAGAIN 2. CURL_DBG_SOCK_RMAX: max amount of bytes read from socket Closes #12035 - http2: refused stream handling for retry - answer HTTP/2 streams refused via a GOAWAY from the server to respond with CURLE_RECV_ERROR in order to trigger a retry on another connection Reported-by: black-desk on github Ref #11859 Closes #12054 Jay Satiro (8 Oct 2023) - CURLOPT_DEBUGFUNCTION.3: warn about internal handles - Warn that the user's debug callback may be called with the handle parameter set to an internal handle. Without this warning the user may assume that the only handles their debug callback receives are the easy handles on which they set CURLOPT_DEBUGFUNCTION. This is a follow-up to f8cee8cc which changed DoH handles to inherit the debug callback function set in the user's easy handle. As a result those handles are now passed to the user's debug callback function. Closes https://github.com/curl/curl/pull/12034 - url: fix typo Daniel Stenberg (8 Oct 2023) - test458: verify --expand-output, expanding a file name accepting option Verifies the fix in #12055 (commit f2c8086ff15e6e995e1) - tool_getparam: accept variable expansion on file names too Reported-by: PBudmark on github Fixes #12048 Closes #12055 - RELEASE-NOTES: synced - multi: do CURLM_CALL_MULTI_PERFORM at two more places ... when it does a state transition but there is no particular socket or timer activity. This was made apparent when commit b5bb84c removed a superfluous timer expiry. Reported-by: Dan Fandrich. Fixes #12033 Closes #12056 Viktor Szakats (7 Oct 2023) - GHA/linux: mbedtls 3.5.0 + minor dep bumps Closes #12057 Dan Fandrich (7 Oct 2023) - CI: bump OpenLDAP package version on FreeBSD The old one is no longer available. Marc Hoersken (7 Oct 2023) - docs/libcurl/opts/Makefile.inc: add missing manpage files Detected with #9532 Dan Fandrich (7 Oct 2023) - tests: fix a race condition in ftp server disconnect If a client disconnected and reconnected quickly, before the ftp server had a chance to respond, the protocol message/ack (ping/pong) sequence got out of sync, causing messages sent to the old client to be delivered to the new. A disconnect must now be acknowledged and intermediate requests thrown out until it is, which ensures that such synchronization problems can't occur. This problem could affect ftp, pop3, imap and smtp tests. Fixes #12002 Closes #12049 Viktor Szakats (7 Oct 2023) - appveyor: bump mingw-w64 job to gcc 13 (was: 8) This sets gcc 6, 7, 9, 13 in our test mix (was: 6, 7, 8, 9). Adding a modern gcc version to the tests. (The gcc 8 job used to take around 50 minutes. The new image with gcc 13 finished in 32, 35, 34 minutes in the 3 test runs so far.) It also adds a modern CMake version and OS env to our mingw-w64 builds. Closes #12051 David Benjamin (6 Oct 2023) - openssl: use X509_ALGOR_get0 instead of reaching into X509_ALGOR While the struct is still public in OpenSSL, there is a (somewhat inconvenient) accessor. Use it to remain compatible if it becomes opaque in the future. Closes #12038 Daniel Stenberg (6 Oct 2023) - curl_easy_pause.3: mention it works within callbacks Reported-by: Maxim Dzhura Bug: https://curl.se/mail/lib-2023-10/0010.html Closes #12046 - curl_easy_pause.3: mention h2/h3 buffering Asked-by: Maxim Dzhura Ref: https://curl.se/mail/lib-2023-10/0011.html Closes #12045 Viktor Szakats (6 Oct 2023) - cmake: re-add missed C89 headers for specific detections We removed C89 `setjmp.h` and `signal.h` detections and excluded them from the global header list we use when detecting functions [1]. Then missed to re-add these headers to the specific functions which need them to be detected [2]. Fix this omission in this patch. [1] Follow-up to 3795fcde995d96db641ddbcc8a04f9f0f03bef9f #11951 [2] Follow-up to 96c29900bcec32dd6bc8e9857c8871ff4b8b8ed9 #11940 Closes #12043 Daniel Stenberg (6 Oct 2023) - multi: set CURLM_CALL_MULTI_PERFORM after switch to DOING_MORE Since there is nothing to wait for there. Avoids the test 1233 hang reported in #12033. Reported-by: Dan Fandrich Closes #12042 Dan Fandrich (5 Oct 2023) - test1903: actually verify the cookies after the test The test otherwise could do just about anything (except leak memory in debug mode) and its bad behaviour wouldn't be detected. Now, check the resulting cookie file to ensure the cookies are still there. Closes #12041 - test: add missing s The tests will otherwise fail if curl has them disabled. - test1906: set a lower timeout since it's hit on Windows msys2 builds actually hit the connect timeout in normal operation, so lower the timeout from 5 minutes to 5 seconds to reduce test time. Ref: #11328 Closes #12036 Daniel Stenberg (5 Oct 2023) - RELEASE-NOTES: synced Jay Satiro (5 Oct 2023) - idn: fix WinIDN null ptr deref on bad host - Return CURLE_URL_MALFORMAT if IDN hostname cannot be converted from UTF-8 to UTF-16. Prior to this change a failed conversion erroneously returned CURLE_OK which meant 'decoded' pointer (what would normally point to the punycode) would not be written to, remain NULL and be dereferenced causing an access violation. Closes https://github.com/curl/curl/pull/11983 Dan Fandrich (4 Oct 2023) - tests: close the shell used to start sshd This shell isn't needed once sshd starts, so use "exec" so it doesn't stick around. Closes #12032 Daniel Stenberg (4 Oct 2023) - base64: also build for curl Since the tool itself now uses the base64 code using the curlx way, it needs to build also when the tool needs it. Starting now, the tool build defines BULDING_CURL to allow lib-side code to use it. Follow-up to 2e160c9c6525 Closes #12010 Eduard Strehlau (4 Oct 2023) - tests: Fix zombie processes left behind by FTP tests. ftpserver.pl correctly cleans up spawned server processes, but forgets to wait for the shell used to spawn them. This is barely noticeable during a normal testrun, but causes process exhaustion and test failure during a complete torture run of the FTP tests. Fixes #12018 Closes #12020 Dan Fandrich (4 Oct 2023) - github/labeler: improve labeler matches - test574: add a timeout to the test This one hangs occasionally, so this will speed up a test run and allow logs to be seen when it does. Closes #12025 - tests: propagate errors in libtests Use the test macros to automatically propagate some errors, and check and log others while running the tests. This can help in debugging exactly why a test has failed. - tests: set --expect100-timeout to improve test reliability On an overloaded server, the default 1 second timeout can go by without the test server having a chance to respond with the expected headers, causing tests to fail. Increase the 1 second timeout to 99 seconds so this failure mode is no longer a problem on test 1129. Some other tests already set a high value, but make them consistently 99 seconds so if something goes wrong the test is stalled for less time. Ref: #11328 - CI: ignore the "flaky" and "timing-dependent" test results in CMake This was already done for automake builds but CMake builds were missed. Test 1086 actually causes the test harness to crash with: Warning: unable to close filehandle DWRITE properly: Broken pipe at C:/projec ts/curl/tests/ftpserver.pl line 527 Rather than fix it now, this change leaves test 1086 entirely skipped on those builds that show this problem. Follow-up to 589dca761 Ref: #11865 Viktor Szakats (4 Oct 2023) - cmake: improve OpenLDAP builds - cmake: detect OpenLDAP based on function `ldap_init_fd`. autotools does this. autotools also publishes this detection result in `HAVE_LDAP_INIT_FD`. We don't mimic that with CMake as the source doesn't use this value. (it might need to be remove-listed in `scripts/cmp-config.pl` for future OpenLDAP test builds.) This also deletes existing self-declaration method via the CMake-specific `CURL_USE_OPENLDAP` configuration. - cmake: define `LDAP_DEPRECATED=1` for OpenLDAP. Like autotools does. This fixes a long list of these warnings: ``` /usr/local/opt/openldap/include/ldap.h:1049:5: warning: 'LDAP_DEPRECATED' i s not defined, evaluates to 0 [-Wundef] ``` - cmake: delete LDAP TODO comment no longer relevant. Also: - autotools: replace domain name `dummy` with `0.0.0.0` in LDAP feature detection functions. Ref: #11964 (effort to sync cmake detections with autotools) Closes #12024 - cmake: fix unity builds for more build combinations By using unique static function/variable names in source files implementing these interfaces. - OpenLDAP combined with any SSH backend. - MultiSSL with mbedTLS, OpenSSL, wolfSSL, SecureTransport. Closes #12027 Daniel Stenberg (4 Oct 2023) - tests: remove leading spaces from some tags The threee tags ``, `` and `` were frequently used with a leading space that this removes. The reason this habbit is so widespread in testcases is probably that they have been copy and pasted. Hence, fixing them all now might curb this practice from now on. Closes #12028 Viktor Szakats (4 Oct 2023) - GHA: bump actions/checkout Follow-up to 2e0fa50fc16b9339f51e0a7bfff0352829323acb #11964 Follow-up to c39585d9b7ef3cbfc1380812dec60e7b275b6af3 #12000 Closes #12023 - spelling: fix codespell 2.2.6 typos Closes #12019 Daniel Stenberg (3 Oct 2023) - GHA: add workflow to compare configure vs cmake outputs Uses scripts/cmp-config.pl two compare two curl_config.h files, presumbly generated with configure and cmake. It displays the differences and filters out a lot of known lines we ignore. The script also shows the matches that were *not* used. Possibly subjects for removal. Closes #11964 - appveyor: enable test 571 Follow-up from 8a940fd55c175f7 / #12013 Closes #12017 Viktor Szakats (3 Oct 2023) - build: alpha-sort source files for lib and src Closes #12014 - cmake: delete old `HAVE_LDAP_URL_PARSE` logic Left there by accident after adding proper detection for this. Follow-up to 772f0d8edf1c3c2745543f42388ccec5a16ee2c0 #12006 Ref: #11964 (effort to sync cmake detections with autotools) Closes #12015 Stefan Eissing (3 Oct 2023) - tests: increase lib571 timeout from 3s to 30s - 3s is too short for our CI, making this test fail occasionally - test usually experiences no delay run locally, so 30s wont hurt Closes #12013 Viktor Szakats (3 Oct 2023) - cmake: fix unity with Windows Unicode + TrackMemory Found the root cause of the startup crash in unity builds with Unicode and TrackMemory enabled at the same time. We must make sure that the `memdebug.h` header doesn't apply to `lib/curl_multibyte.c` (as even noted in a comment there.) In unity builds all headers apply to all sources, including `curl_multibyte.c`. This probably resulted in an infinite loop on startup. Exclude this source from unity compilation with TrackMemory enabled, in both libcurl and curl tool. Enable unity mode for a debug Unicode CI job to keep it tested. Also delete the earlier workaround that fully disabled unity for affected builds. Follow-up to d82b080f6374433ce7c98241329189ad2d3976f8 #12005 Follow-up to 3f8fc25720900b14b7432f4bd93407ca15311719 #11095 Closes #11928 - cmake: disable unity mode with Windows Unicode + TrackMemory "TrackMemory" is `ENABLE_DEBUG=ON` (aka `ENABLE_CURLDEBUG=ON`, aka `-DCURLDEBUG`). There is an issue with memory tracking and Unicode when built in "unity" mode, which results in the curl tool crashing right on startup, even without any command-line option. Interestingly this doesn't happen under WINE (at least on the system I tested this on), but consistenly happens on real Windows machines. Crash is 0xC0000374 heap corruption. Both shared and static curl executables are affected. This limitation probably won't hit too many people, but it remains a TODO to find and fix the root cause and drop this workaround. Example builds and runs: https://ci.appveyor.com/project/curlorg/curl/builds/48169111/job/17cptxhtpubd 7iwj#L313 (static) https://ci.appveyor.com/project/curlorg/curl/builds/48169111/job/76e1ge758tby qu9c#L317 (shared) Follow-up to 3f8fc25720900b14b7432f4bd93407ca15311719 #11095 Ref: #11928 Closes #12005 - cmake: tidy-up `NOT_NEED_LBER_H` detection Follow-up to 772f0d8edf1c3c2745543f42388ccec5a16ee2c0 #12006 - appveyor: rewrite batch in PowerShell + CI improvements 1. Rewrite in PowerShell: - rewrite MS-DOS batch build script in PowerShell. - move some bash operations into native PowerShell. - fixups for PowerShell insisting on failure when a command outputs something to stderr. - fix to actually run `curl -V` after every build. (and exclude ARM64 builds.) - also say why we skipped `curl -V` if we had to skip. - fix CMake warnings about unused configuration variables, by adapting these dynamically for build cases. - dedupe OpenSSL path into a variable. - disable `test1451` failing with a warning anyway due to missing python impacket. (after trying and failing to install impacket) PowerShell promotes these warnings to errors by PowerShell. We can also suppress they wholesale if they start causing issues in the future, like we already to with `autoreconf` and `./configure`. PowerShell is better than MS-DOS batches, so the hope is this makes it easier to extend and maintain the AppVeyor build logic. POSIX/bash isn't supported inline by AppVeyor on Windows build machines, but we are okay to keep it in an external script, so it's also an option. 2. CI improvements: - enable tests for a "unity" build job. - speed-up CI initialization by using shallow clones of the curl repo. - speed-up CMake MSVC jobs with `TrackFileAccess=false`. - enable parallelism in `VisualStudioSolution` builds. - display CMake version before builds. - always show the CPU in job names. - tell which jobs are build-only in job names. - move `TESTING:` value next to `DISABLED_TESTS:` in two jobs. - add `config.log` (autotools) to dumped logs (need to enable manually). 3. Style: - use single-quotes in YAML like we do in other CI YAML files. It also allows to drop quoting characters and lighter to write/read. (keep double quotes for PowerShell strings needing expansion.) Closes #11999 - cmake: fix `HAVE_LDAP_SSL`, `HAVE_LDAP_URL_PARSE` on non-Windows - set `HAVE_LDAP_URL_PARSE` if `ldap_url_parse` function exists. Before this patch we set it based it on the presence of `stricmp`, which correctly enabled it on e.g. Windows, but was inaccurate for other platforms. - always set `HAVE_LDAP_SSL` if an LDAP backend is detected and LDAPS is not explicitly disabled. This mimics autotools behaviour. Previously we set it only for Windows LDAP. After this fix, LDAPS is correctly enabled in default macOS builds. - enable LDAP[S] for a CMake macOS CI job. Target OS X 10.9 (Mavericks) to avoid deprecation warnings for LDAP API. - always detect `HAVE_LDAP_SSL_H`, even with LDAPS explicitly disabled. This doesn't make much sense, but let's do it to sync behaviour with autotools. - fix benign typo in variable name. Ref: #11964 (effort to sync cmake detections with autotools) Closes #12006 - autotools: restore `HAVE_IOCTL_*` detections This restores `CURL_CHECK_FUNC_IOCTL` detection. I deleted it in 4d73854462f30948acab12984b611e9e33ee41e6 and c3456652a0c72d1845d08df9769667db7e159949 (2022-08), because the `HAVE_IOCTL` result it generated was unused in the source. But, I did miss the fact that this had two dependent checks: `CURL_CHECK_FUNC_IOCTL_FIONBIO`, `CURL_CHECK_FUNC_IOCTL_SIOCGIFADDR` that we do actually need: `HAVE_IOCTL_FIONBIO`, `HAVE_IOCTL_SIOCGIFADDR`. Regression from 4d73854462f30948acab12984b611e9e33ee41e6 Ref: #11964 (effort to sync cmake detections with autotools) Closes #12008 Daniel Stenberg (2 Oct 2023) - RELEASE-PROCEDURE.md: updated coming release dates - RELEASE-NOTES: synced Viktor Szakats (1 Oct 2023) - cmake: pre-cache `HAVE_POLL_FINE` on Windows Windows doesn't support `poll()`, so we can safely skip checking for fine poll. Closes #12003 - gha: bump actions to latest versions - actions@checkout@v4 (from v3 and v2) - fsfe/reuse-action@v2 (from v1) Closes #12000 Stefan Eissing (30 Sep 2023) - h2: testcase and fix for pausing h2 streams - refs #11982 where it was noted that paused transfers may close successfully without delivering the complete data - made sample poc into tests/http/client/h2-pausing.c and added test_02_27 to reproduce Closes #11989 Fixes #11982 Reported-by: Harry Sintonen Viktor Szakats (30 Sep 2023) - cmake: validate `CURL_DEFAULT_SSL_BACKEND` config value Before this patch CMake builds accepted any value and it was used at runtime as-is. This patch make sure that the selected default backend is also enabled in the build. It also enforces a full lowercase value. This improves reproducibility and brings CMake in sync with autotools which already worked like described above. Follow-up to 26c7feb8b9d51a57fab3325571b4bbfa03b11af0 #11774 Closes #11998 - autotools: adjust `CURL_CA_PATH` value to CMake autotools was using the same value as CMake, but with an ending slash. Delete the ending slash to match configurations. Ref: #11964 (effort to sync cmake detections with autotools) Closes #11997 - cmake: detect `sys/wait.h` and `netinet/udp.h` Ref: #11964 (effort to sync cmake detections with autotools) Closes #11996 Daniel Stenberg (30 Sep 2023) - lib: provide and use Curl_hexencode Generates a lower case ASCII hex output from a binary input. Closes #11990 - configure: check for the capath by default ... if the chosen TLS backend supports it: OpenSSL, GnuTLS, mbedTLS or wolfSS L cmake: synced Assisted-by: Viktor Szakats Closes #11987 - wolfssl: ignore errors in CA path The default wolfSSL_CTX_load_verify_locations() function is quite picky with the certificates it loads and will for example return error if just one of the certs has expired. With the *_ex() function and its WOLFSSL_LOAD_FLAG_IGNORE_ERR flag, it behaves more similar to what OpenSSL does by default. Even the set of default certs on my Debian unstable has several expired ones. Assisted-by: Juliusz Sosinowicz Assisted-by: Michael Osipov Closes #11987 - create-dirs.d: clarify it also uses --output-dirs Reported-by: Robert Simpson Fixes #11991 Closes #11995 Viktor Szakats (30 Sep 2023) - appveyor: fix yamlint issues, indent Also: - use double quotes in all batch if statements. Closes #11994 - cmake: detect `HAVE_CLOCK_GETTIME_MONOTONIC_RAW` Based on existing autotools logic. Ref: #11964 (effort to sync cmake detections with autotools) Closes #11981 - cmake: detect `HAVE_GETADDRINFO_THREADSAFE` Based on existing autotools logic. autotools checks for old versions of the allowlisted target OSes and disables this feature when seeing them. In CMake we assume we're running on newer systems and enable regardless of OS version. autotools always runs all 3 probes for non-fast-tracked systems and enables this feature if any one of them was successful. To save configuration time, CMake stops at the first successful check. OpenBSD is not fast-tracked and then gets blocklisted as a generic BSD system. I haven't double-checked if this is correct, but looks odd. Ref: #11964 (effort to sync cmake detections with autotools) Closes #11979 - cmake: fix `HAVE_WRITABLE_ARGV` detection Move detection before the creation of detection results in `curl_config.h`. Ref: #11964 (effort to sync cmake detections with autotools) Closes #11978 - appveyor: minor improvements - run `curl -V` after builds to see if they run and with what features. Except for one job where a CRT DLL is missing. And ARM64 which should fail, but is silently not launched instead. - copy libcurl DLL next to curl tool and tests binaries in shared mode. This makes it possible to run the tests. (We don't run tests after these builds yet.) - list the DLLs and EXEs present after the builds. - add `DEBUG` variable for CMake builds to allow disabling it, for testing non-debug builds. (currently enabled for all) - add commented lines that dump CMake configuration logs for debugging build/auto-detection issues. - add gcc version to jobs where missing. - switch a job to the native MSYS2 mingw-w64 toolchain. This adds gcc 9 to the build mix. - make `SHARED=OFF` and `OPENSSL=OFF` defaults global. - delete a duplicate backslash. Closes #11976 - configure: replace adhoc domain with `localhost` in tests Reviewed-by: Daniel Stenberg Closes #11988 - tidy-up: use more example domains Also make use of the example TLD: https://en.wikipedia.org/wiki/.example Reviewed-by: Daniel Stenberg Closes #11992 Dan Fandrich (29 Sep 2023) - runtests: display the test status if tests appear hung It sometimes happens that a test hangs during a test run and never returns. The test harness will wait indefinitely for the results and on CI servers the CI job will eventually be killed after an hour or two. At the end of a test run, if results haven't come in within a couple of minutes, display the status of all test runners and what tests they're running to help in debugging the problem. This feature is really only kick in with parallel testing enabled, which is fine because without parallel testing it's usually easy to tell what test has hung. Closes #11980 - github/labeler: remove workaround for labeler This was added due to what seemed to be a bug regarding the sync-labels: config option, but it looks like it wasn't necessary. Follow-up to b2b0534e7 Viktor Szakats (29 Sep 2023) - docs: upgrade an URL to HTTPS in `BINDINGS.md` [ci skip] Daniel Stenberg (29 Sep 2023) - docs: replace made up domains with example.com in FAQ and MANUAL.md - example.com was made for this purpose. - reduces the risk that one of those domains suddenly start hosting something nasty and we provide links to them Closes #11986 Michael Osipov (29 Sep 2023) - acinclude.m4: Document proper system truststore on FreeBSD The default system truststore on FreeBSD has been /etc/ssl/certs for many years now. It is managed canonically through certctl(8) and contains hashed symlinks for OpenSSL and other TLS providers. The previous ones require security/ca_root_nss which might not be installed o r will not contain any custom CA certificates. Closes #11985 Daniel Stenberg (29 Sep 2023) - FAQ: How do I upgrade curl.exe in Windows? This is a growing question, better answer it here to get somewhere to point users to. Closes #11984 Viktor Szakats (28 Sep 2023) - cmake: pre-cache `HAVE_BASENAME` for mingw-w64 and MSVC `basename` is present in mingw-w64, missing from MSVC. Pre-cache accordingly to make configure faster. Notice that `basename` has a bug so we later disable it even with mingw-w64: https://github.com/curl/curl/blob/781242ffa44a9f9b95b6da5ac5a1bf6372ec6257/li b/curl_setup.h#L820-L825 Closes #11974 Daniel Stenberg (28 Sep 2023) - cmake: add missing checks - check for arc4random. To make rand.c use it accordingly. - check for fcntl - fix fseek detection - add SIZEOF_CURL_SOCKET_T - fix USE_UNIX_SOCKETS - define HAVE_SNPRINTF to 1 - check for fnmatch - check for sched_yield - remove HAVE_GETPPID duplicate from curl_config.h - add HAVE_SENDMSG Ref: #11964 Co-authored-by: Viktor Szakats Closes #11973 - configure: remove unused checks - for sys/uio.h - for fork - for connect Ref: #11964 Closes #11973 - lib: remove TIME_WITH_SYS_TIME It is not used in any code anywhere. Ref: #11964 Closes #11975 - docs: update curl man page references Detected by the manpage-syntax update Closes #11963 - manpage-syntax: verify curl man page references 1. References to curl symbols are now checked that they indeed exist as man pages. This for \f references as well as the names referenced in the SEE ALSO section. Allowlist curl.1 since it is not always built in builds 2. References to curl symbols that lack section now causes warning, since tha t will prevent them from getting linked properly 3. Check for "bare" references to curl functions and warn, they should be references Closes #11963 - cmake: add check for suseconds_t And fix the HAVE_LONGLONG define Ref: #11964 Closes #11977 Viktor Szakats (28 Sep 2023) - tidy-up: whitespace fixes Closes #11972 - cmake: detect TLS-SRP in OpenSSL/wolfSSL/GnuTLS With new option `CURL_DISABLE_SRP=ON` to force-disable it. To match existing option and detection logic in autotools. Also: - fix detecting GnuTLS. We assume `nettle` as a GnuTLS dependency. - add CMake GnuTLS CI job. - bump AppVeyor CMake OpenSSL MSVC job to OpenSSL 1.1.1 (from 1.0.2) TLS-SRP fails to detect with 1.0.2 due to an OpenSSL header bug. - fix compiler warning when building with GnuTLS and disabled TLS-SRP. - fix comment typos, whitespace. Ref: #11964 Closes #11967 - tool: use our own stderr variable Earlier this year we changed our own stderr variable to use the standard name `stderr` (to avoid bugs where someone is using `stderr` instead of the curl-tool specific variable). This solution needed to override the standard `stderr` symbol via the preprocessor. This in turn didn't play well with unity builds and caused curl tool to crash or stay silent due to an uninitialized stderr. This was a hard to find issue, fixed by manually breaking out one file from the unity sources. To avoid two these two tricks, this patch implements a different solution: Restore using our own local variable for our stderr output and leave `stderr` as-is. To avoid using `stderr` by mistake, add a `checksrc` rule (based on logic we already used in lib for `strerror`) that detects any `stderr` use in `src` and points to using our own variable instead: `tool_stderr`. Follow-up to 06133d3e9b8aeb9e9ca0b3370c246bdfbfc8619e Follow-up to 2f17a9b654121dd1ecf4fc043c6d08a9da3522db Closes #11958 Loïc Yhuel (28 Sep 2023) - connect: only start the happy eyeballs timer when needed The timeout is only used when there is a second address family, for the delayed eyeballer. Closes #11939 Daniel Stenberg (28 Sep 2023) - tool_operate: free 'gateway' correctly Pointed out by Coverity. The fix in 93885cf3a8d4e was incomplete. Also removed repeated wording in IPFS related error messages. Closes #11969 Stefan Eissing (28 Sep 2023) - lib: move handling of `data->req.writer_stack` into Curl_client_write() - move definitions from content_encoding.h to sendf.h - move create/cleanup/add code into sendf.c - installed content_encoding writers will always be called on Curl_client_write(CLIENTWRITE_BODY) - Curl_client_cleanup() frees writers and tempbuffers from paused transfers, irregardless of protocol Closes #11908 Loïc Yhuel (28 Sep 2023) - multi: round the timeout up to prevent early wakeups Curl_timediff rounds down to the millisecond, so curl_multi_perform can be called too early, then we get a timeout of 0 and call it again. The code already handled the case of timeouts which expired less than 1ms in the future. By rounding up, we make sure we will never ask the platform to wake up too early. Closes #11938 Daniel Stenberg (28 Sep 2023) - RELEASE-NOTES: spell out that IPFS is via gateway - RELEASE-NOTES: synced - tool_operate: avoid strlen() -1 on zero length content from file Follow-up to 65b563a96a226649ba12cb1e Closes #11959 - tool_operate: fix memory mixups Switch to plain getenv() from curl_getenv() to avoid the allocation and having to keep track of which free() or curl_free() that need to be used. Coverity found issues and a memory leak. Follow-up to 65b563a96a226649ba12cb1e Closes #11959 Viktor Szakats (27 Sep 2023) - curl-functions.m4: fixup recent bad edits Follow-up to 96c29900bcec32dd6bc8e9857c8871ff4b8b8ed9 #11940 Closes #11966 Daniel Stenberg (27 Sep 2023) - curl-functions.m4: fix include line This made the getaddrinfo detection fail, but we did not spot it in the CI because it graciously falled back to using legacy functions instead! Follow-up to 96c29900bcec (#11940) Closes #11965 - inet_ntop: add typecast to silence Coverity CID 1024653: Integer handling issues (SIGN_EXTENSION) Suspicious implicit sign extension: "src[i]" with type "unsigned char const" (8 bits, unsigned) is promoted in "src[i] << (1 - i % 2 << 3)" to type "int" (32 bits, signed), then sign-extended to type "unsigned long" (64 bits, unsigned). If "src[i] << (1 - i % 2 << 3)" is greater than 0x7FFFFFFF, the upper bits of the result will all be 1. 111 words[i/2] |= (src[i] << ((1 - (i % 2)) << 3)); The value will not be greater than 0x7FFFFFFF so this still cannot happen. Also, switch to ints here instead of longs. The values stored are 16 bit so at least no need to use 64 bit variables. Also, longs are 32 bit on some platforms so this logic still needs to work with 32 bits. Closes #11960 - docs: adapt SEE ALSO sections to new requirements To please manpage-syntax.pl used by test 1173 Closes #11957 - manpage-syntax.pl: verify SEE ALSO syntax - Enforce a single reference per .BR line - Skip the quotes around the section number for example (3) - Insist on trailing commas on all lines except the last - Error on comma on the last SEE ALSO entry - List the entries alpha-sorted, not enforced just recommended Closes #11957 - connect: expire the timeout when trying next ... so that it gets called again immediately and can continue trying addresses to connect to. Otherwise it might unnecessarily wait for a while there. Fixes #11920 Reported-by: Loïc Yhuel Closes #11935 - http: remove wrong comment for http_should_fail Reported-by: Christian Schmitz Ref: #11936 Closes #11941 Dan Fandrich (26 Sep 2023) - tool_setopt: remove unused function tool_setopt_flags This function is identical to tool_setopt_bitmask except that it treats the argument as unsigned. Closes #11943 Viktor Szakats (26 Sep 2023) - cmake: add feature checks for `memrchr` and `getifaddrs` - `HAVE_MEMRCHR` for `memrchr`. - `HAVE_GETIFADDRS` for `getifaddrs`. This was present in `lib/curl_config.h.cmake` but missed the detection logic. To match existing autotools feature checks. Closes #11954 - cmake: move global headers to specific checks Before this patch we added standard headers unconditionally to the global list of headers used for feature checks. This is unnecessary and also doesn't help CMake 'Generate' performance. This patch moves these headers to each feature check where they are actually needed. Stop using `stddef.h`, as it seems unnecessary. I've used autotools' `m4/curl-functions.m4` to figure out these dependencies. Also delete checking for the C89 standard header `time.h`, that I missed in the earlier commit. Ref: 96c29900bcec32dd6bc8e9857c8871ff4b8b8ed9 #11940 Closes #11951 - src/mkhelp: make generated code pass `checksrc` Closes #11955 - tests: show which curl tool `runtests.pl` is using To help debugging when there is issue finding or running it. Closes #11953 - CI/azure: make `MAKEFLAGS` global to parallelize all jobs https://dev.azure.com/daniel0244/curl/_build/results?buildId=17528 (before) https://dev.azure.com/daniel0244/curl/_build/results?buildId=17545 (after, wi th -j3) Closes #11952 - CI/azure: migrate old mingw MSYS1 jobs to MSYS2 Also delete an accidental variable reference. Follow-up to 38029101e2d78ba125732b3bab6ec267b80a0e72 Closes #11945 Daniel Stenberg (26 Sep 2023) - docs: add see also curl_multi_get_handles to some man pages Assisted-by: Jay Satiro Closes #11942 Viktor Szakats (26 Sep 2023) - cmake: assume `_fseeki64` and no `fseeko` on Windows `_fseeki64` is present in mingw-w64 1.0 (2011-09-26) headers, and at least Watcom C 1.9 (2010) headers and MSVS 2008 [1]. `fseeko` is not present in any of these. (mingw-w64 1.0 also offers `fseeko64`.) [1] https://github.com/curl/curl/pull/11944#issuecomment-1734995004 Follow-up to 9c7165e96a3a9a2d0b7059c87c699b5ca8cdae93 #11918 Closes #11950 - build: delete checks for C89 standard headers Delete checks and guards for standard C89 headers and assume these are available: `stdio.h`, `string.h`, `time.h`, `setjmp.h`, `stdlib.h`, `stddef.h`, `signal.h`. Some of these we already used unconditionally, some others we only used for feature checks. Follow-up to 9c7165e96a3a9a2d0b7059c87c699b5ca8cdae93 #11918 (for `stdio.h` i n CMake) Closes #11940 Stefan Eissing (26 Sep 2023) - multiif.h: remove Curl_multi_dump declaration Follow-up to d850eea2 which removed the Curl_multi_dump definition. Closes https://github.com/curl/curl/pull/11946 Jay Satiro (26 Sep 2023) - config-win32: define HAVE__FSEEKI64 Follow-up to 9c7165e9 which added an fseeko wrapper to the lib that calls _fseeki64 if it is available. Closes https://github.com/curl/curl/pull/11944 - docs: explain how PINNEDPUBLICKEY is independent of VERIFYPEER - Explain that peer verification via CURLOPT_PINNEDPUBLICKEY takes place even if peer verification via CURLOPT_SSL_VERIFYPEER is turned off. The behavior is verified by test2048. Bug: https://github.com/curl/curl/issues/2935#issuecomment-418371872 Reported-by: claudiusaiz@users.noreply.github.com Bug: https://github.com/curl/curl/discussions/11910 Reported-by: Hakan Sunay Halil Closes https://github.com/curl/curl/pull/11930 Stefan Eissing (26 Sep 2023) - openssl: improve ssl shutdown handling - If SSL shutdown is not finished then make an additional call to SSL_read to gather additional tracing. - Fix http2 and h2-proxy filters to forward do_close() calls to the next filter. For example h2 and SSL shutdown before and after this change: Before: Curl_conn_close -> cf_hc_close -> Curl_conn_cf_discard_chain -> ssl_cf_destroy After: Curl_conn_close -> cf_hc_close -> cf_h2_close -> cf_setup_close -> ssl_cf_close Note that currently the tracing does not show output on the connection closure handle. Refer to discussion in #11878. Ref: https://github.com/curl/curl/discussions/11878 Closes https://github.com/curl/curl/pull/11858 Loïc Yhuel (26 Sep 2023) - multi: fix small timeouts Since Curl_timediff rounds down to the millisecond, timeouts which expire in less than 1ms are considered as outdated and removed from the list. We can use Curl_timediff_us instead, big timeouts could saturate but this is not an issue. Closes #11937 Viktor Szakats (25 Sep 2023) - cmake: fix stderr initialization in unity builds Before this patch, in certain build configurations the curl tool may not have displayed anything (debug, macOS), or crashed at startup (debug, Windows). Follow-up to 3f8fc25720900b14b7432f4bd93407ca15311719 Necessary after 2f17a9b654121dd1ecf4fc043c6d08a9da3522db Closes #11929 - cmake: fix missing `zlib.h` when compiling `libcurltool` Came up while testing debug/testing build for Windows. I'm not sure why it didn't come up in earlier tests with similar config. `tool_hugehelp.c` might indeed require `zlib.h` and without linking `CURL_LIBS` to the `curltool` target, CMake doesn't seem to add detected dependency headers to the compiler command. ``` [ 25%] Building C object src/CMakeFiles/curltool.dir/tool_hugehelp.c.obj cd .../curl/bld-cmake-llvm-x64/src && /usr/local/opt/llvm/bin/clang --target=x86_64-w64-mingw32 --sysroot=/usr/local/opt/mingw-w64/toolchain-x8 6_64 -DCURLDEBUG -DCURL_STATICLIB -DHAVE_CONFIG_H -DUNICODE -DUNITTESTS -D_UNICO DE -I.../curl/include -I.../curl/lib -I.../curl/bld-cmake-llvm-x64/lib -I.../curl/bld-cmake-llvm-x64/include -I.../curl/src -Wno-unused-command-li ne-argument -D_UCRT -DDEBUGBUILD -DHAS_ALPN -DUSE_MANUAL=1 -fuse-ld=lld -Wl,-s -static -libgcc -lucrt [...] -O3 -DNDEBUG -municode -MD -MT src/CMakeFiles/curltool.dir/tool_hugehelp.c.obj -MF CMakeFiles/curltool.dir/tool_hugehelp.c.obj.d -o CMakeFiles/curltool.dir/tool_hugehelp.c.obj -c .../curl/bld-cmake-llvm-x 64/src/tool_hugehelp.c .../curl/bld-cmake-llvm-x64/src/tool_hugehelp.c:6:10: fatal error: 'zlib.h' f ile not found 6 | #include | ^~~~~~~~ ``` Follow-up to 39e7c22bb459c2e818f079984989a26a09741860 Closes #11927 - cmake: fix duplicate symbols when linking tests The linker resolves this automatically in non-unity builds. In unity builds the linker cannot drop a single object with the duplicates, resulting in these errors. The root issue is that we started including certain objects both via both libcurlu and libcurltool libs. Regression from 39e7c22bb459c2e818f079984989a26a09741860 Windows errors: ``` [ 3%] Linking C executable unit1303.exe [ 3%] Building C object tests/server/CMakeFiles/rtspd.dir/__/__/lib/curl_mul tibyte.c.obj ../../lib/libcurlu-d.a(unity_0.c.obj): In function `curlx_convert_UTF8_to_wch ar': C:/projects/curl/lib/curl_multibyte.c:44: multiple definition of `curlx_conve rt_UTF8_to_wchar' ../../src/libcurltool-d.a(unity_0.c.obj):C:/projects/curl/lib/curl_multibyte. c:44: first defined here ../../lib/libcurlu-d.a(unity_0.c.obj): In function `curlx_convert_wchar_to_UT F8': C:/projects/curl/lib/curl_multibyte.c:66: multiple definition of `curlx_conve rt_wchar_to_UTF8' ../../src/libcurltool-d.a(unity_0.c.obj):C:/projects/curl/lib/curl_multibyte. c:66: first defined here ../../lib/libcurlu-d.a(unity_0.c.obj): In function `curlx_win32_open': C:/projects/curl/lib/curl_multibyte.c:92: multiple definition of `curlx_win32 _open' ../../src/libcurltool-d.a(unity_0.c.obj):C:/projects/curl/lib/curl_multibyte. c:92: first defined here ../../lib/libcurlu-d.a(unity_0.c.obj): In function `curlx_win32_fopen': C:/projects/curl/lib/curl_multibyte.c:120: multiple definition of `curlx_win3 2_fopen' ../../src/libcurltool-d.a(unity_0.c.obj):C:/projects/curl/lib/curl_multibyte. c:120: first defined here ../../lib/libcurlu-d.a(unity_0.c.obj): In function `curlx_win32_stat': [...] ``` Ref: https://ci.appveyor.com/project/curlorg/curl/builds/48110107/job/nvlhpt9 aa4ehny5q#L247 macOS errors: ``` [ 56%] Linking C executable unit1302 duplicate symbol '_curlx_sotouz' in: ../../lib/libcurlu.a(unity_0_c.c.o) ../../src/libcurltool.a(unity_0_c.c.o) duplicate symbol '_curlx_sitouz' in: ../../lib/libcurlu.a(unity_0_c.c.o) ../../src/libcurltool.a(unity_0_c.c.o) duplicate symbol '_curlx_uztosz' in: ../../lib/libcurlu.a(unity_0_c.c.o) ../../src/libcurltool.a(unity_0_c.c.o) [...] ``` with config: ``` -DCMAKE_UNITY_BUILD=ON \ -DENABLE_DEBUG=ON -DBUILD_TESTING=ON -DCMAKE_C_FLAGS=-DDEBUGBUILD \ -DBUILD_SHARED_LIBS=ON \ -DBUILD_STATIC_LIBS=OFF ``` Closes #11926 - cmake: lib `CURL_STATICLIB` fixes (Windows) - always define `CURL_STATICLIB` when building libcurl for Windows. This disables `__declspec(dllexport)` for exported libcurl symbols. In normal mode (hide symbols) these exported symbols are specified via `libcurl.def`. When not hiding symbols, all symbols are exported by default. Regression from 1199308dbc902c52be67fc805c72dd2582520d30 Fixes #11844 - fix to omit `libcurl.def` when not hiding private symbols. Regression from 2ebc74c36a19a1700af394c16855ce144d9878e3 - fix `ENABLED_DEBUG=ON` + shared curl tool Windows builds by also omitting `libcurl.def` in this case, and exporting all symbols instead. This ensures that a shared curl tool can access all debug functions which are not normally exported from libcurl DLL. - delete `INTERFACE_COMPILE_DEFINITIONS "CURL_STATICLIB"` for "objects" target. Follow-up to 2ebc74c36a19a1700af394c16855ce144d9878e3 - delete duplicate `BUILDING_LIBCURL` definitions. - fix `HIDES_CURL_PRIVATE_SYMBOLS` to not overwrite earlier build settings. Follow-up to 1199308dbc902c52be67fc805c72dd2582520d30 Closes #11914 Daniel Stenberg (25 Sep 2023) - RELEASE-NOTES: synced Dan Fandrich (25 Sep 2023) - tests: fix log directory path in IPFS tests Hard-coding the log directory name fails with parallel tests. Follow-up to 65b563a96 Ref: #8805 Daniel Stenberg (25 Sep 2023) - curl_multi_get_handles: get easy handles from a multi handle Closes #11750 Stefan Eissing (25 Sep 2023) - http: h1/h2 proxy unification - use shared code for setting up the CONNECT request when tunneling, used in HTTP/1.x and HTTP/2 proxying - eliminate use of Curl_buffer_send() and other manipulations of `data->req` or `data->state.ulbuf` Closes #11808 Natanael Copa (25 Sep 2023) - lib: use wrapper for curl_mime_data fseek callback fseek uses long offset which does not match with curl_off_t. This leads to undefined behavior when calling the callback and caused failure on arm 32 bit. Use a wrapper to solve this and use fseeko which uses off_t instead of long. Thanks to the nice people at Libera IRC #musl for helping finding this out. Fixes #11882 Fixes #11900 Closes #11918 - configure: sort AC_CHECK_FUNCS No functional changes. Daniel Stenberg (25 Sep 2023) - warnless: remove unused functions Previously put there for use with the intel compiler Closes #11932 - GHA/linux: run singleuse to detect single-use global functions Use --unit for configure --enable-debug builds Closes #11932 - singleuse: add scan for use in other source codes This should reduce false-positive to almost zero. Checks for presence in unit tests if --unit is specified, which is intended for debug builds where unit testing is enabled. Closes #11932 - multi: remove Curl_multi_dump A debug-only function that is basically never used. Removed to ease the use of the singleuse script to detect non-static functions not used outside the file where it is defined. Closes #11931 Viktor Szakats (24 Sep 2023) - tests: fix compiler warnings Seen with llvm 17 on Windows x64. ``` .../curl/tests/server/rtspd.c:136:13: warning: no previous extern declaration for non-static variable 'logdir' [-Wmissing-variable-declarations] 136 | const char *logdir = "log"; | ^ .../curl/tests/server/rtspd.c:136:7: note: declare 'static' if the variable i s not intended to be used outside of this translation unit 136 | const char *logdir = "log"; | ^ .../curl/tests/server/rtspd.c:137:6: warning: no previous extern declaration for non-static variable 'loglockfile' [-Wmissing-variable-declarations] 137 | char loglockfile[256]; | ^ .../curl/tests/server/rtspd.c:137:1: note: declare 'static' if the variable i s not intended to be used outside of this translation unit 137 | char loglockfile[256]; | ^ .../curl/tests/server/fake_ntlm.c:43:13: warning: no previous extern declarat ion for non-static variable 'logdir' [-Wmissing-variable-declarations] 43 | const char *logdir = "log"; | ^ .../curl/tests/server/fake_ntlm.c:43:7: note: declare 'static' if the variabl e is not intended to be used outside of this translation unit 43 | const char *logdir = "log"; | ^ .../curl/src/tool_doswin.c:350:8: warning: possible misuse of comma operator here [-Wcomma] 350 | ++d, ++s; | ^ .../curl/src/tool_doswin.c:350:5: note: cast expression to void to silence wa rning 350 | ++d, ++s; | ^~~ | (void)( ) ``` ``` .../curl/tests/libtest/lib540.c:146:27: warning: result of comparison 'long' > 2147483647 is always false [-Wtautological-type-limit-compare] 146 | int itimeout = (L > (long)INT_MAX) ? INT_MAX : (int)L; | ~ ^ ~~~~~~~~~~~~~ 1 warning generated. .../curl/tests/libtest/libntlmconnect.c:195:31: warning: result of comparison 'long' > 2147483647 is always false [-Wtautological-type-limit-compare] 195 | int itimeout = (timeout > (long)INT_MAX) ? INT_MAX : (int)timeo ut; | ~~~~~~~ ^ ~~~~~~~~~~~~~ 1 warning generated. .../curl/tests/libtest/lib591.c:117:31: warning: result of comparison 'long' > 2147483647 is always false [-Wtautological-type-limit-compare] 117 | int itimeout = (timeout > (long)INT_MAX) ? INT_MAX : (int)timeo ut; | ~~~~~~~ ^ ~~~~~~~~~~~~~ 1 warning generated. .../curl/tests/libtest/lib597.c:99:31: warning: result of comparison 'long' > 2147483647 is always false [-Wtautological-type-limit-compare] 99 | int itimeout = (timeout > (long)INT_MAX) ? INT_MAX : (int)timeo ut; | ~~~~~~~ ^ ~~~~~~~~~~~~~ 1 warning generated. ``` Seen on macOS Intel: ``` .../curl/tests/server/sws.c:440:64: warning: field precision should have type 'int', but argument has type 'size_t' (aka 'unsigned long') [-Wformat] msnprintf(logbuf, sizeof(logbuf), "Got request: %s %.*s HTTP/%d.%d" , ~~^~ 1 warning generated. ``` Closes #11925 Jay Satiro (24 Sep 2023) - url: fix netrc info message - Fix netrc info message to use the generic ".netrc" filename if the user did not specify a netrc location. - Update --netrc doc to add that recent versions of curl on Windows prefer .netrc over _netrc. Before: * Couldn't find host google.com in the (nil) file; using defaults After: * Couldn't find host google.com in the .netrc file; using defaults Closes https://github.com/curl/curl/pull/11904 Dan Fandrich (23 Sep 2023) - wolfssh: do cleanup in Curl_ssh_cleanup Closes: #11921 Daniel Stenberg (24 Sep 2023) - tool_listhelp: regenerated Polished the --ipfs-gateway description Fixed the --trace-config description The script also fixed some other small mistakes Closes #11923 Viktor Szakats (23 Sep 2023) - Makefile.mk: always set `CURL_STATICLIB` for lib (Windows) Also fix to export all symbols in Windows debug builds, making `-debug-dyn` builds work with `-DCURL_STATICLIB` set. Ref: https://github.com/curl/curl/pull/11914 (same for CMake) Closes #11924 Daniel Stenberg (23 Sep 2023) - quic: set ciphers/curves the same way regular TLS does for OpenSSL/BoringSSL Fixes #11796 Reported-by: Karthikdasari0423 on github Assisted-by: Jay Satiro Closes #11836 - test457: verify --max-filesize with chunked encoding - lib: let the max filesize option stop too big transfers too Previously it would only stop them from getting started if the size is known to be too big then. Update the libcurl and curl docs accordingly. Fixes #11810 Reported-by: Elliot Killick Assisted-by: Jay Satiro Closes #11820 Viktor Szakats (23 Sep 2023) - mingw: delete support for legacy mingw.org toolchain Drop support for "old" / "legacy" / "classic" / "v1" / "mingw32" MinGW: https://en.wikipedia.org/wiki/MinGW, https://osdn.net/projects/mingw/ Its homepage used to be http://mingw.org/ [no HTTPS], and broken now. It supported the x86 CPU only and used a old Windows API header and implib set, often causing issues. It also misses most modern Windows features, offering old versions of both binutils and gcc (no llvm/clang support). It was last updated 2 years ago. curl now relies on toolchains based on the mingw-w64 project: https://www.mingw-w64.org/ https://sourceforge.net/projects/mingw-w64/ https://www.msys2.org/ https://github.com/msys2/msys2 https://github.com/mstorsjo/llvm-mingw (Also available via Linux and macOS package managers.) Closes #11625 Mark Gaiser (23 Sep 2023) - curl: add support for the IPFS protocols: - ipfs:// - ipns:// This allows you tu use ipfs in curl like: curl ipfs:// and curl ipns:// For more information consult the readme at: https://curl.se/docs/ipfs.html Closes #8805 Daniel Stenberg (23 Sep 2023) - bufq: remove Curl_bufq_skip_and_shift (unused) Closes #11915 - scripts/singleuse.pl: add curl_global_trace Viktor Szakats (22 Sep 2023) - cmake: fix unity symbol collisions in h2 builds Regression from 331b89a319d0067fa1e6441719307cfef9c7960f Reviewed-by: Daniel Stenberg Reviewed-by: Jay Satiro Closes #11912 Daniel Stenberg (22 Sep 2023) - RELEASE-NOTES: synced Dan Fandrich (21 Sep 2023) - github/labeler: improve the match patterns This includes new rules for setting the appleOS and logging labels and matches on some example files. Also, enable dot mode for wildcard matches in the .github directory. Daniel Stenberg (21 Sep 2023) - upload-file.d: describe the file name slash/backslash handling Closes #11911 Jakub Jelen (21 Sep 2023) - libssh: cap SFTP packet size sent Due to libssh limitations Signed-off-by: Jakub Jelen Closes #11804 Daniel Stenberg (21 Sep 2023) - curl.h: mark CURLSSLBACKEND_NSS as deprecated since 8.3.0 Closes #11905 - mailmap: unify Michael Osipov under a single email Ted Lyngmo (21 Sep 2023) - docs: use CURLSSLBACKEND_NONE [ssl] use CURLSSLBACKEND_NONE instead of (curl_sslbackend)-1 in documentation and examples. Signed-off-by: Ted Lyngmo Closes #11909 Dan Fandrich (21 Sep 2023) - github/labeler: give the sync-labels config item a default value This shouldn't be necessary and is likely a bug with this beta version of the labeller. Also, fix the negative matches for the documentation label. Follow-up to dd12b452a Closes #11907 - github/labeler: fix up more the labeler config format The new version didn't like the workaround we had for a bug in the previous labeler version, and it should no longer be needed. Follow-up to dd12b452a Closes #11906 - github/labeler: fix indenting to try to appease labeller Follow-up to dd12b452a Jay Satiro (21 Sep 2023) - libssh2: fix error message on failed pubkey-from-file - If libssh2_userauth_publickey_fromfile_ex returns -1 then show error message "SSH public key authentication failed: Reason unknown (-1)". When libssh2_userauth_publickey_fromfile_ex returns -1 it does so as a generic error and therefore doesn't set an error message. AFAICT that is not documented behavior. Prior to this change libcurl retrieved the last set error message which would be from a previous function failing. That resulted in misleading auth failed error messages in verbose mode. Bug: https://github.com/curl/curl/issues/11837#issue-1891827355 Reported-by: consulion@users.noreply.github.com Closes https://github.com/curl/curl/pull/11881 Stefan Eissing (21 Sep 2023) - pytest: exclude test_03_goaway in CI runs due to timing dependency Closes #11860 - lib: disambiguate Curl_client_write flag semantics - use CLIENTWRITE_BODY *only* when data is actually body data - add CLIENTWRITE_INFO for meta data that is *not* a HEADER - debug assertions that BODY/INFO/HEADER is not used mixed - move `data->set.include_header` check into Curl_client_write so protocol handlers no longer have to care - add special in FTP for `data->set.include_header` for historic, backward compatible reasons - move unpausing of client writes from easy.c to sendf.c, so that code is in one place and can forward flags correctly Closes #11885 Patrick Monnerat (21 Sep 2023) - tftpd: always use curl's own tftp.h Using the system's provided arpa/tftp.h and optimizing, GCC 12 detects and reports a stringop-overread warning: tftpd.c: In function ‘write_behind.isra’: tftpd.c:485:12: warning: ‘write’ reading between 1 and 2147483647 bytes f rom a region of size 0 [-Wstringop-overread] 485 | return write(test->ofile, writebuf, count); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from tftpd.c:71: /usr/include/arpa/tftp.h:58:30: note: source object ‘tu_data’ of size 0 58 | char tu_data[0]; /* data or error stri ng */ | ^~~~~~~ This occurs because writebuf points to this field and the latter cannot be considered as being of dynamic length because it is not the last field in the structure. Thus it is bound to its declared size. This commit always uses curl's own version of tftp.h where the target field is last in its structure, effectively avoiding the warning. As HAVE_ARPA_TFTP_H is not used anymore, cmake/configure checks for arpa/tftp.h are removed. Closes #11897 Dan Fandrich (20 Sep 2023) - test1474: make precheck more robust on non-Solaris systems If uname -r returns something odd, perl could return an error code and the test would be erroneously skipped. The qx// syntax avoid this. Followup to 08f9b2148 - github/labeler: switch to the 5 beta version This version adds an important feature that will allow more PRs to be labelled. Rather than being limited to labeling PRs with files that match a single glob, it can now label them if multiple changed files match any one of a number of globs. Daniel Stenberg (20 Sep 2023) - lib: enable hmac for digest as well Previously a build that disabled NTLM and aws-sigv4 would fail to build since the hmac was disabled, but it is also needed for digest auth. Follow-up to e92edfbef64448ef Fixes #11890 Reported-by: Aleksander Mazur Closes #11896 - idn: if idn2_check_version returns NULL, return error ... this avoids a NULL dereference for this unusual case. Reported-by: s0urc3_ on hackerone Closes #11898 - http: fix CURL_DISABLE_BEARER_AUTH breakage When bearer auth was disabled, the if/else logic got wrong and caused problems. Follow-up to e92edfbef64448ef461 Fixes #11892 Reported-by: Aleksander Mazur Closes #11895 Michael Osipov (20 Sep 2023) - wolfssl: allow capath with CURLOPT_CAINFO_BLOB Remain consistent with OpenSSL. While CAfile is nulled as documented with CURLOPT_CAINFO_BLOB, CApath remains intact. Closes #11886 - wolfssl: use ssl_cafile/ssl_capath variables consistent with openssl.c Closes #11886 Dan Fandrich (19 Sep 2023) - test1474: disable test on NetBSD, OpenBSD and Solaris 10 These kernels only send a fraction of the requested amount of the first large block, invalidating the assumptions of the test and causing it to fail. Assisted-by: Christian Weisgerber Ref: https://curl.se/mail/lib-2023-09/0021.html Closes #11888 Ryan Schmidt (20 Sep 2023) - cmake, configure: also link with CoreServices When linking with CoreFoundation, also link with CoreServices which is apparently required to avoid an NSInvalidArgumentException in software linking with libcurl on macOS Sonoma 14 and later. Fixes #11893 Closes #11894 Marc Hoersken (19 Sep 2023) - CI/azure: remove pip, wheel, cryptography, pyopenssl and impacket These dependencies are now already included in the Docker image. Ref: https://github.com/mback2k/curl-docker-winbuildenv/commit/2607a31bcab544 b41d15606e97f38cf312c1ce56 Closes #11889 Daniel Stenberg (19 Sep 2023) - wolfssl: if CURLOPT_CAINFO_BLOB is set, ignore the CA files Ref: #11883 Reported-by: Michael Osipov Closes #11884 - RELEASE-NOTES: synced - test3103: CURLOPT_COOKIELIST test - cookie: set ->running in cookie_init even if data is NULL This is a regression introduced in b1b326ec500 (shipped in curl 8.1.0) Test 3103 verifies. Fixes #11875 Reported-by: wangp on github Closes #11876 - test498: total header size for all redirects is larger than accepted - http: use per-request counter to check too large headers Not the counter that accumulates all headers over all redirects. Follow-up to 3ee79c1674fd6 Do a second check for 20 times the limit for the accumulated size for all headers. Fixes #11871 Reported-by: Joshix-1 on github Closes #11872 Jay Satiro (18 Sep 2023) - THANKS: add Eric Murphy He reported #11850 (quiche build error) but I forgot to add a 'reported-by' entry in the fix 267e14f1. Daniel Stenberg (18 Sep 2023) - h2-proxy: remove left-over mistake in drain_tunnel() Left-over from 331b89a319 Reported-by: 南宫雪珊 Closes https://github.com/curl/curl/pull/11877 vvb2060 (18 Sep 2023) - lib: failf/infof compiler warnings Closes #11874 Daniel Stenberg (17 Sep 2023) - rand: fix 'alnum': array is too small to include a terminating null character It was that small on purpose, but this change now adds the null byte to avoid the error. Follow-up to 3aa3cc9b052353b1 Reported-by: Dan Fandrich Ref: #11838 Closes #11870 Mathias Fuchs (16 Sep 2023) - cmake: fix the help text to the static build option in CMakeLists.txt Closes #11843 John Haugabook (16 Sep 2023) - MANUAL.md: change domain to example.com Closes #11866 Daniel Stenberg (16 Sep 2023) - doh: inherit DEBUGFUNCTION/DATA When creating new transfers for doing DoH, they now inherit the debug settings from the initiating transfer, so that the application can redirect and handle the verbose output correctly even for the DoH transfers. Reported-by: calvin2021y on github Fixes #11864 Closes #11869 Dan Fandrich (16 Sep 2023) - http_aws_sigv4: fix sorting with empty parts When comparing with an empty part, the non-empty one is always considered greater-than. Previously, the two would be considered equal which would randomly place empty parts amongst non-empty ones. This showed as a test 439 failure on Solaris as it uses a different implementation of qsort() that compares parts differently. Fixes #11855 Closes #11868 - CI: ignore the "flaky" and "timing-dependent" test results CI builds will now run these tests, but will ignore the results if they fail. The relevant tests are ones that are sensitive to timing or have edge conditions that make them more likely to fail on CI servers, which are often heavily overloaded and slow. This change only adds two additional tests to be ignored, since the others already had the flaky keyword. Closes #11865 - runtests: eliminate a warning on old perl versions The warning "Use of implicit split to @_ is deprecated" showed between perl versions about 5.8 through 5.11. - tests: log the test result code after each libtest This makes it easier to determine the test status. Also, capitalize FAILURE and ABORT messages in log lines to make them easier to spot. Harry Sintonen (16 Sep 2023) - misc: better random strings Generate alphanumerical random strings. Prior this change curl used to create random hex strings. This was mostly okay, but having alphanumerical random strings is better: The strings have more entropy in the same space. The MIME multipart boundary used to be mere 64-bits of randomness due to being 16 hex chars. With these changes the boundary is 22 alphanumerical chars, or little over 130 bits of randomness. Closes #11838 Daniel Stenberg (15 Sep 2023) - cookie: reduce variable scope, add const - cookie: do not store the expire or max-age strings Convert it to an expire time at once and save memory. Closes #11862 - cookie: remove unnecessary struct fields Plus: reduce the hash table size from 256 to 63. It seems unlikely to make much of a speed difference for most use cases but saves 1.5KB of data per instance. Closes #11862 - RELEASE-NOTES: synced Bumped to 8.4.0, the next presumed version Dan Fandrich (14 Sep 2023) - test2600: remove special case handling for USE_ALARM_TIMEOUT This was originally added to handle platforms that supported only 1 second granularity in connect timeouts, but after some recent changes the test currently permafails on several Windows platforms. The need for this special-case was removed in commit 8627416, which increased the connect timeout in all cases to well above 1 second. Fixes #11767 Closes #11849 Daniel Stenberg (14 Sep 2023) - SECURITY-PROCESS.md. call it vulnerability disclosure policy SECURITY-PROCESS.md -> VULN-DISCLOSURE-POLICY.md This a name commonly used for a document like this. This name helps users find it. Closes #11852 Junho Choi (14 Sep 2023) - quiche: fix build error with --with-ca-fallback - Fix build error when curl is built with --with-quiche and --with-ca-fallback. - Add --with-ca-fallback to the quiche CI job. Fixes https://github.com/curl/curl/issues/11850 Closes https://github.com/curl/curl/pull/11847 Jay Satiro (14 Sep 2023) - escape: replace Curl_isunreserved with ISUNRESERVED - Use the ALLCAPS version of the macro so that it is clear a macro is being called that evaluates the variable multiple times. - Also capitalize macro isurlpuntcs => ISURLPUNTCS since it evaluates a variable multiple times. This is a follow-up to 291d225a which changed Curl_isunreserved into an alias macro for ISUNRESERVED. The problem is the former is not easily identified as a macro by the caller, which could lead to a bug. For example, ISUNRESERVED(*foo++) is easily identifiable as wrong but Curl_isunreserved(*foo++) is not even though they both are the same. Closes https://github.com/curl/curl/pull/11846 Dan Fandrich (13 Sep 2023) - tests: increase the default server logs lock timeout This timeout is used to wait for the server to finish writing its logs before checking them against the expected values. An overloaded machine could take more than the two seconds previously allocated, so increase the timeout to 5 seconds. Ref: #11328 Closes #11834 - tests: increase TEST_HANG_TIMEOUT in two tests These tests had a 5 second timeout compared to 60 seconds for all other tests. Make these consistent with the others for more reliability on heavily-loaded machines. Ref: #11328 - test1056: disable on Windows This test relies on the IPv6 scope field being ignored when connecting to ipv6-localhost (i.e. [::1%259999] is treated as [::1]). Maybe this is a bit dodgy, but it works on all our test platforms except Windows. This test was disabled manually on all Windows CI builds already, so instead add an incompatible feature and precheck so it's skipped on Windows everywhere automatically. - test587: add a slight delay after test This test is designed to connect to the server, then immediately send a few bytes and disconnect. In some situations, such as on a loaded server, this doesn't give the server enough time to write its lock file before its existence is checked. The test harness then fails to find the server's input log file (because it hasn't been written yet) and fails the test. By adding a short delay after the test, the HTTP server has enough time to write its lock file which gives itself more time to write its remaining files. Ref: #11328 - tests: stop overriding the lock timeout These tests reduce the server lock wait timeout which can increase flakiness on loaded machines. Since this is merely an optimization, eliminate them in favour of reliability. Ref: #11328 - tests: add some --expect100-timeout to reduce timing dependencies These tests can fail when the test machine is so slow that the test HTTP server didn't get a chance to complete before the client's one second 100-continue timeout triggered. Increase that 1 second to 999 seconds so this situation doesn't happen. Ref: #11328 - test661: return from test early in case of curl error - tests: add the timing-dependent keyword on several tests These are ones likely to fail on heavily-loaded machines that alter the normal test timing. Most of these tests already had the flaky keyword since this condition makes them more likely to fail on CI. - test1592: greatly increase the maximum test timeout It was too short to be reliable on heavily loaded CI machines, and as a fail-safe only, it didn't need to be short. Ref: #11328 - test: minor test cleanups Remove an obsolete block of code in tests 2032 & 576. Add a comment in test 1474. - tests: quadruple the %FTPTIME2 and %FTPTIME3 timeouts This gives more of a margin for error when running on overloaded CI servers. Ref: #11328 - tests: improve SLOWDOWN test reliability by reducing sent data These tests are run in SLOWDOWN mode which adds a 10 msec delay after each character output, which means it takes at least 1.6 seconds (and 320 kernel calls) just to get through the long welcome banner. On an overloaded system, this can end up taking much more than 1.6 seconds, and even more than the 7 or 16 second curl timeout that the tests rely on, causing them to fail. Reducing the size of the welcome banner drops the total number of characters sent before the transfer starts by more than half, which reduces the opportunity for test-breaking slowdowns by the same amount. Ref: #11328 - test650: fix an end tag typo Jay Satiro (13 Sep 2023) - tool_cb_wrt: fix debug assertion - Fix off-by-one out-of-bounds array index in Windows debug assertion. Bug: https://github.com/curl/curl/commit/af3f4e41#r127212213 Reported-by: Gisle Vanem Daniel Stenberg (13 Sep 2023) - ctype: add ISUNRESERVED() ... and make Curl_isunreserved() use that macro instead of providing a separate funtion for the purpose. Closes #11840 Version 8.3.0 (13 Sep 2023) Daniel Stenberg (13 Sep 2023) - RELEASE-NOTES: syn ced curl 8.3.0 release - THANKS: contributors from 8.3.0 Thorsten Klein (12 Sep 2023) - cmake: set SIZEOF_LONG_LONG in curl_config.h in order to support 32bit builds regarding wolfssl CTC_SETTINGS Closes #11839 Jay Satiro (12 Sep 2023) - curl_ngtcp2: fix error message - http_aws_sigv4: handle no-value user header entries - Handle user headers in format 'name:' and 'name;' with no value. The former is used when the user wants to remove an internal libcurl header and the latter is used when the user actually wants to send a no-value header in the format 'name:' (note the semi-colon is converted by libcurl to a colon). Prior to this change the AWS header import code did not special case either of those and the generated AWS SignedHeaders would be incorrect. Reported-by: apparentorder@users.noreply.github.com Ref: https://curl.se/docs/manpage.html#-H Fixes https://github.com/curl/curl/issues/11664 Closes https://github.com/curl/curl/pull/11668 Dan Fandrich (11 Sep 2023) - CI: run pytest with the -v option This lists of the test cases being run so it can be tracked over time. Closes #11824 Daniel Stenberg (11 Sep 2023) - HTTP3: the msquic backend is not functional I ask that we do not submit bugs for this backend just yet as we know it does not fully work. Closes #11831 Closes #11819 - aws_sigv4: the query canon code miscounted URL encoded input Added some extra ampersands to test 439 to verify "blank" query parts Follow-up to fc76a24c53b08cdf Closes #11829 vvb2060 (11 Sep 2023) - quic: don't set SNI if hostname is an IP address We already do this for TLS connections. RFC 6066 says: Literal IPv4 and IPv6 addresses are not permitted in "HostName". Ref: https://www.rfc-editor.org/rfc/rfc6066#section-3 Fixes https://github.com/curl/curl/issues/11827 Closes https://github.com/curl/curl/pull/11828 Daniel Stenberg (10 Sep 2023) - RELEASE-NOTES: synced PK, and many contributors, see the THANKS file. All rights reserved. Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Except as contained in this notice, the name of a copyright holder shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization of the copyright holder. PK in the login part of the URL. For example: http://test:pass;auth=NTLM@example.com would be equivalent to specifying --user test:pass;auth=NTLM or --user test:pass --ntlm from the command line. Additionally this should be implemented for proxy base URLs as well. 5.6 alt-svc should fallback if alt-svc does not work The alt-svc: header provides a set of alternative services for curl to use instead of the original. If the first attempted one fails, it should try the next etc and if all alternatives fail go back to the original. See https://github.com/curl/curl/issues/4908 5.7 Require HTTP version X or higher curl and libcurl provide options for trying higher HTTP versions (for example HTTP/2) but then still allows the server to pick version 1.1. We could consider adding a way to require a minimum version. See https://github.com/curl/curl/issues/7980 6. TELNET 6.1 ditch stdin Reading input (to send to the remote server) on stdin is a crappy solution for library purposes. We need to invent a good way for the application to be able to provide the data to send. 6.2 ditch telnet-specific select Move the telnet support's network select() loop go away and merge the code into the main transfer loop. Until this is done, the multi interface will not work for telnet. 6.3 feature negotiation debug data Add telnet feature negotiation data to the debug callback as header data. 6.4 exit immediately upon connection if stdin is /dev/null If it did, curl could be used to probe if there is an server there listening on a specific port. That is, the following command would exit immediately after the connection is established with exit code 0: curl -s --connect-timeout 2 telnet://example.com:80 NOTIFY=SUCCESS,FAILURE" ); https://github.com/curl/curl/issues/8232 7.2 Enhanced capability support Add the ability, for an application that uses libcurl, to obtain the list of capabilities returned from the EHLO command. 7.3 Add CURLOPT_MAIL_CLIENT option Rather than use the URL to specify the mail client string to present in the HELO and EHLO commands, libcurl should support a new CURLOPT specifically for specifying this data as the URL is non-standard and to be honest a bit of a hack ;-) Please see the following thread for more information: https://curl.se/mail/lib-2012-05/0178.html 8. POP3 8.2 Enhanced capability support Add the ability, for an application that uses libcurl, to obtain the list of capabilities returned from the CAPA command. 9. IMAP 9.1 Enhanced capability support Add the ability, for an application that uses libcurl, to obtain the list of capabilities returned from the CAPABILITY command. 10. LDAP 10.1 SASL based authentication mechanisms Currently the LDAP module only supports ldap_simple_bind_s() in order to bind to an LDAP server. However, this function sends username and password details using the simple authentication mechanism (as clear text). However, it should be possible to use ldap_bind_s() instead specifying the security context information ourselves. 10.2 CURLOPT_SSL_CTX_FUNCTION for LDAPS CURLOPT_SSL_CTX_FUNCTION works perfectly for HTTPS and email protocols, but it has no effect for LDAPS connections. https://github.com/curl/curl/issues/4108 10.3 Paged searches on LDAP server https://github.com/curl/curl/issues/4452 10.4 Certificate-Based Authentication LDAPS not possible with MAC and Windows with Certificate-Based Authentication https://github.com/curl/curl/issues/9641 11. SMB 11.1 File listing support Add support for listing the contents of a SMB share. The output should probably be the same as/similar to FTP. 11.2 Honor file timestamps The timestamp of the transferred file should reflect that of the original file. 11.3 Use NTLMv2 Currently the SMB authentication uses NTLMv1. 11.4 Create remote directories Support for creating remote directories when uploading a file to a directory that does not exist on the server, just like --ftp-create-dirs. 12. FILE 12.1 Directory listing for FILE: Add support for listing the contents of a directory accessed with FILE. The output should probably be the same as/similar to FTP. 13. TLS 13.1 TLS-PSK with OpenSSL Transport Layer Security pre-shared key ciphersuites (TLS-PSK) is a set of cryptographic protocols that provide secure communication based on pre-shared keys (PSKs). These pre-shared keys are symmetric keys shared in advance among the communicating parties. https://github.com/curl/curl/issues/5081 13.2 Provide mutex locking API Provide a libcurl API for setting mutex callbacks in the underlying SSL library, so that the same application code can use mutex-locking independently of OpenSSL or GnutTLS being used. 13.3 Defeat TLS fingerprinting By changing the order of TLS extensions provided in the TLS handshake, it is sometimes possible to circumvent TLS fingerprinting by servers. The TLS extension order is of course not the only way to fingerprint a client. See https://github.com/curl/curl/issues/8119 13.4 Cache/share OpenSSL contexts "Look at SSL cafile - quick traces look to me like these are done on every request as well, when they should only be necessary once per SSL context (or once per handle)". The major improvement we can rather easily do is to make sure we do not create and kill a new SSL "context" for every request, but instead make one for every connection and reuse that SSL context in the same style connections are reused. It will make us use slightly more memory but it will libcurl do less creations and deletions of SSL contexts. Technically, the "caching" is probably best implemented by getting added to the share interface so that easy handles who want to and can reuse the context specify that by sharing with the right properties set. https://github.com/curl/curl/issues/1110 13.5 Export session ids Add an interface to libcurl that enables "session IDs" to get exported/imported. Cris Bailiff said: "OpenSSL has functions which can serialise the current SSL state to a buffer of your choice, and recover/reset the state from such a buffer at a later date - this is used by mod_ssl for apache to implement and SSL session ID cache". 13.6 Provide callback for cert verification OpenSSL supports a callback for customised verification of the peer certificate, but this does not seem to be exposed in the libcurl APIs. Could it be? There is so much that could be done if it were. 13.7 Less memory massaging with Schannel The Schannel backend does a lot of custom memory management we would rather avoid: the repeated alloc + free in sends and the custom memory + realloc system for encrypted and decrypted data. That should be avoided and reduced for 1) efficiency and 2) safety. 13.8 Support DANE DNS-Based Authentication of Named Entities (DANE) is a way to provide SSL keys and certs over DNS using DNSSEC as an alternative to the CA model. https://www.rfc-editor.org/rfc/rfc6698.txt An initial patch was posted by Suresh Krishnaswamy on March 7th 2013 (https://curl.se/mail/lib-2013-03/0075.html) but it was a too simple approach. See Daniel's comments: https://curl.se/mail/lib-2013-03/0103.html . libunbound may be the correct library to base this development on. Björn Stenberg wrote a separate initial take on DANE that was never completed. 13.9 TLS record padding TLS (1.3) offers optional record padding and OpenSSL provides an API for it. I could make sense for libcurl to offer this ability to applications to make traffic patterns harder to figure out by network traffic observers. See https://github.com/curl/curl/issues/5398 13.10 Support Authority Information Access certificate extension (AIA) AIA can provide various things like CRLs but more importantly information about intermediate CA certificates that can allow validation path to be fulfilled when the HTTPS server does not itself provide them. Since AIA is about downloading certs on demand to complete a TLS handshake, it is probably a bit tricky to get done right. See https://github.com/curl/curl/issues/2793 13.11 Some TLS options are not offered for HTTPS proxies Some TLS related options to the command line tool and libcurl are only provided for the server and not for HTTPS proxies. --proxy-tls-max, --proxy-tlsv1.3, --proxy-curves and a few more. For more Documentation on this see: https://curl.se/libcurl/c/tls-options.html https://github.com/curl/curl/issues/12286 13.12 Reduce CA certificate bundle reparsing When using the OpenSSL backend, curl will load and reparse the CA bundle at the creation of the "SSL context" when it sets up a connection to do a TLS handshake. A more effective way would be to somehow cache the CA bundle to avoid it having to be repeatedly reloaded and reparsed. See https://github.com/curl/curl/issues/9379 13.13 Make sure we forbid TLS 1.3 post-handshake authentication RFC 8740 explains how using HTTP/2 must forbid the use of TLS 1.3 post-handshake authentication. We should make sure to live up to that. See https://github.com/curl/curl/issues/5396 13.14 Support the clienthello extension Certain stupid networks and middle boxes have a problem with SSL handshake packets that are within a certain size range because how that sets some bits that previously (in older TLS version) were not set. The clienthello extension adds padding to avoid that size range. https://datatracker.ietf.org/doc/html/rfc7685 https://github.com/curl/curl/issues/2299 13.15 Select signature algorithms Consider adding an option or a way for users to select TLS signature algorithm. The signature algorithms set by a client are used directly in the supported signature algorithm in the client hello message. https://github.com/curl/curl/issues/12982 14. GnuTLS 14.2 check connection Add a way to check if the connection seems to be alive, to correspond to the SSL_peak() way we use with OpenSSL. 15. Schannel 15.1 Extend support for client certificate authentication The existing support for the -E/--cert and --key options could be extended by supplying a custom certificate and key in PEM format, see: - Getting a Certificate for Schannel https://msdn.microsoft.com/en-us/library/windows/desktop/aa375447.aspx 15.2 Extend support for the --ciphers option The existing support for the --ciphers option could be extended by mapping the OpenSSL/GnuTLS cipher suites to the Schannel APIs, see - Specifying Schannel Ciphers and Cipher Strengths https://msdn.microsoft.com/en-us/library/windows/desktop/aa380161.aspx 15.4 Add option to allow abrupt server closure libcurl w/schannel will error without a known termination point from the server (such as length of transfer, or SSL "close notify" alert) to prevent against a truncation attack. Really old servers may neglect to send any termination point. An option could be added to ignore such abrupt closures. https://github.com/curl/curl/issues/4427 16. SASL 16.1 Other authentication mechanisms Add support for other authentication mechanisms such as OLP, GSS-SPNEGO and others. 16.2 Add QOP support to GSSAPI authentication Currently the GSSAPI authentication only supports the default QOP of auth (Authentication), whilst Kerberos V5 supports both auth-int (Authentication with integrity protection) and auth-conf (Authentication with integrity and privacy protection). 17. SSH protocols 17.1 Multiplexing SSH is a perfectly fine multiplexed protocols which would allow libcurl to do multiple parallel transfers from the same host using the same connection, much in the same spirit as HTTP/2 does. libcurl however does not take advantage of that ability but will instead always create a new connection for new transfers even if an existing connection already exists to the host. To fix this, libcurl would have to detect an existing connection and "attach" the new transfer to the existing one. 17.2 Handle growing SFTP files The SFTP code in libcurl checks the file size *before* a transfer starts and then proceeds to transfer exactly that amount of data. If the remote file grows while the transfer is in progress libcurl will not notice and will not adapt. The OpenSSH SFTP command line tool does and libcurl could also just attempt to download more to see if there is more to get... https://github.com/curl/curl/issues/4344 17.3 Read keys from ~/.ssh/id_ecdsa, id_ed25519 The libssh2 backend in curl is limited to only reading keys from id_rsa and id_dsa, which makes it fail connecting to servers that use more modern key types. https://github.com/curl/curl/issues/8586 17.4 Support CURLOPT_PREQUOTE The two other QUOTE options are supported for SFTP, but this was left out for unknown reasons. 17.5 SSH over HTTPS proxy with more backends The SSH based protocols SFTP and SCP did not work over HTTPS proxy at all until PR https://github.com/curl/curl/pull/6021 brought the functionality with the libssh2 backend. Presumably, this support can/could be added for the other backends as well. 17.6 SFTP with SCP:// OpenSSH 9 switched their 'scp' tool to speak SFTP under the hood. Going forward it might be worth having curl or libcurl attempt SFTP if SCP fails to follow suite. 18. Command line tool 18.1 sync "curl --sync http://example.com/feed[1-100].rss" or "curl --sync http://example.net/{index,calendar,history}.html" Downloads a range or set of URLs using the remote name, but only if the remote file is newer than the local file. A Last-Modified HTTP date header should also be used to set the mod date on the downloaded file. 18.2 glob posts Globbing support for -d and -F, as in 'curl -d "name=foo[0-9]" URL'. This is easily scripted though. 18.4 --proxycommand Allow the user to make curl run a command and use its stdio to make requests and not do any network connection by itself. Example: curl --proxycommand 'ssh pi@raspberrypi.local -W 10.1.1.75 80' \ http://some/otherwise/unavailable/service.php See https://github.com/curl/curl/issues/4941 18.5 UTF-8 filenames in Content-Disposition RFC 6266 documents how UTF-8 names can be passed to a client in the Content-Disposition header, and curl does not support this. https://github.com/curl/curl/issues/1888 18.6 Option to make -Z merge lined based outputs on stdout When a user requests multiple lined based files using -Z and sends them to stdout, curl will not "merge" and send complete lines fine but may send partial lines from several sources. https://github.com/curl/curl/issues/5175 18.8 Consider convenience options for JSON and XML? Could we add `--xml` or `--json` to add headers needed to call rest API: `--xml` adds -H 'Content-Type: application/xml' -H "Accept: application/xml" and `--json` adds -H 'Content-Type: application/json' -H "Accept: application/json" Setting Content-Type when doing a GET or any other method without a body would be a bit strange I think - so maybe only add CT for requests with body? Maybe plain `--xml` and ` --json` are a bit too brief and generic. Maybe `--http-json` etc? See https://github.com/curl/curl/issues/5203 18.9 Choose the name of file in braces for complex URLs When using braces to download a list of URLs and you use complicated names in the list of alternatives, it could be handy to allow curl to use other names when saving. Consider a way to offer that. Possibly like {partURL1:name1,partURL2:name2,partURL3:name3} where the name following the colon is the output name. See https://github.com/curl/curl/issues/221 18.10 improve how curl works in a windows console window If you pull the scrollbar when transferring with curl in a Windows console window, the transfer is interrupted and can get disconnected. This can probably be improved. See https://github.com/curl/curl/issues/322 18.11 Windows: set attribute 'archive' for completed downloads The archive bit (FILE_ATTRIBUTE_ARCHIVE, 0x20) separates files that shall be backed up from those that are either not ready or have not changed. Downloads in progress are neither ready to be backed up, nor should they be opened by a different process. Only after a download has been completed it's sensible to include it in any integer snapshot or backup of the system. See https://github.com/curl/curl/issues/3354 18.12 keep running, read instructions from pipe/socket Provide an option that makes curl not exit after the last URL (or even work without a given URL), and then make it read instructions passed on a pipe or over a socket to make further instructions so that a second subsequent curl invoke can talk to the still running instance and ask for transfers to get done, and thus maintain its connection pool, DNS cache and more. 18.13 Ratelimit or wait between serial requests Consider a command line option that can make curl do multiple serial requests slow, potentially with a (random) wait between transfers. There is also a proposed set of standard HTTP headers to let servers let the client adapt to its rate limits: https://datatracker.ietf.org/doc/draft-ietf-httpapi-ratelimit-headers/ See https://github.com/curl/curl/issues/5406 18.14 --dry-run A command line option that makes curl show exactly what it would do and send if it would run for real. See https://github.com/curl/curl/issues/5426 18.15 --retry should resume When --retry is used and curl actually retries transfer, it should use the already transferred data and do a resumed transfer for the rest (when possible) so that it does not have to transfer the same data again that was already transferred before the retry. See https://github.com/curl/curl/issues/1084 18.16 send only part of --data When the user only wants to send a small piece of the data provided with --data or --data-binary, like when that data is a huge file, consider a way to specify that curl should only send a piece of that. One suggested syntax would be: "--data-binary @largefile.zip!1073741823-2147483647". See https://github.com/curl/curl/issues/1200 18.17 consider file name from the redirected URL with -O ? When a user gives a URL and uses -O, and curl follows a redirect to a new URL, the file name is not extracted and used from the newly redirected-to URL even if the new URL may have a much more sensible file name. This is clearly documented and helps for security since there is no surprise to users which file name that might get overwritten. But maybe a new option could allow for this or maybe -J should imply such a treatment as well as -J already allows for the server to decide what file name to use so it already provides the "may overwrite any file" risk. This is extra tricky if the original URL has no file name part at all since then the current code path will error out with an error message, and we cannot *know* already at that point if curl will be redirected to a URL that has a file name... See https://github.com/curl/curl/issues/1241 18.18 retry on network is unreachable The --retry option retries transfers on "transient failures". We later added --retry-connrefused to also retry for "connection refused" errors. Suggestions have been brought to also allow retry on "network is unreachable" errors and while totally reasonable, maybe we should consider a way to make this more configurable than to add a new option for every new error people want to retry for? https://github.com/curl/curl/issues/1603 18.19 expand ~/ in config files For example .curlrc could benefit from being able to do this. See https://github.com/curl/curl/issues/2317 18.20 host name sections in config files config files would be more powerful if they could set different configurations depending on used URLs, host name or possibly origin. Then a default .curlrc could a specific user-agent only when doing requests against a certain site. 18.21 retry on the redirected-to URL When curl is told to --retry a failed transfer and follows redirects, it might get an HTTP 429 response from the redirected-to URL and not the original one, which then could make curl decide to rather retry the transfer on that URL only instead of the original operation to the original URL. Perhaps extra emphasized if the original transfer is a large POST that redirects to a separate GET, and that GET is what gets the 529 See https://github.com/curl/curl/issues/5462 18.23 Set the modification date on an uploaded file For SFTP and possibly FTP, curl could offer an option to set the modification time for the uploaded file. See https://github.com/curl/curl/issues/5768 18.24 Use multiple parallel transfers for a single download To enhance transfer speed, downloading a single URL can be split up into multiple separate range downloads that get combined into a single final result. An ideal implementation would not use a specified number of parallel transfers, but curl could: - First start getting the full file as transfer A - If after N seconds have passed and the transfer is expected to continue for M seconds or more, add a new transfer (B) that asks for the second half of A's content (and stop A at the middle). - If splitting up the work improves the transfer rate, it could then be done again. Then again, etc up to a limit. This way, if transfer B fails (because Range: is not supported) it will let transfer A remain the single one. N and M could be set to some sensible defaults. See https://github.com/curl/curl/issues/5774 18.25 Prevent terminal injection when writing to terminal curl could offer an option to make escape sequence either non-functional or avoid cursor moves or similar to reduce the risk of a user getting tricked by clever tricks. See https://github.com/curl/curl/issues/6150 18.26 Custom progress meter update interval Users who are for example doing large downloads in CI or remote setups might want the occasional progress meter update to see that the transfer is progressing and has not stuck, but they may not appreciate the many-times-a-second frequency curl can end up doing it with now. 18.27 -J and -O with %-encoded file names -J/--remote-header-name does not decode %-encoded file names. RFC 6266 details how it should be done. The can of worm is basically that we have no charset handling in curl and ascii >=128 is a challenge for us. Not to mention that decoding also means that we need to check for nastiness that is attempted, like "../" sequences and the like. Probably everything to the left of any embedded slashes should be cut off. https://curl.se/bug/view.cgi?id=1294 -O also does not decode %-encoded names, and while it has even less information about the charset involved the process is similar to the -J case. Note that we will not add decoding to -O without the user asking for it with some other means as well, since -O has always been documented to use the name exactly as specified in the URL. 18.28 -J with -C - When using -J (with -O), automatically resumed downloading together with "-C -" fails. Without -J the same command line works. This happens because the resume logic is worked out before the target file name (and thus its pre-transfer size) has been figured out. This can be improved. https://curl.se/bug/view.cgi?id=1169 18.29 --retry and transfer timeouts If using --retry and the transfer timeouts (possibly due to using -m or -y/-Y) the next attempt does not resume the transfer properly from what was downloaded in the previous attempt but will truncate and restart at the original position where it was at before the previous failed attempt. See https://curl.se/mail/lib-2008-01/0080.html and Mandriva bug report https://qa.mandriva.com/show_bug.cgi?id=22565 19. Build 19.2 Enable PIE and RELRO by default Especially when having programs that execute curl via the command line, PIE renders the exploitation of memory corruption vulnerabilities a lot more difficult. This can be attributed to the additional information leaks being required to conduct a successful attack. RELRO, on the other hand, masks different binary sections like the GOT as read-only and thus kills a handful of techniques that come in handy when attackers are able to arbitrarily overwrite memory. A few tests showed that enabling these features had close to no impact, neither on the performance nor on the general functionality of curl. 19.3 Do not use GNU libtool on OpenBSD When compiling curl on OpenBSD with "--enable-debug" it will give linking errors when you use GNU libtool. This can be fixed by using the libtool provided by OpenBSD itself. However for this the user always needs to invoke make with "LIBTOOL=/usr/bin/libtool". It would be nice if the script could have some magic to detect if this system is an OpenBSD host and then use the OpenBSD libtool instead. See https://github.com/curl/curl/issues/5862 19.4 Package curl for Windows in a signed installer See https://github.com/curl/curl/issues/5424 19.5 make configure use --cache-file more and better The configure script can be improved to cache more values so that repeated invokes run much faster. See https://github.com/curl/curl/issues/7753 19.6 build curl with Windows Unicode support The user wants an easier way to tell autotools to build curl with Windows Unicode support, like ./configure --enable-windows-unicode See https://github.com/curl/curl/issues/7229 20. Test suite 20.1 SSL tunnel Make our own version of stunnel for simple port forwarding to enable HTTPS and FTP-SSL tests without the stunnel dependency, and it could allow us to provide test tools built with either OpenSSL or GnuTLS 20.2 nicer lacking perl message If perl was not found by the configure script, do not attempt to run the tests but explain something nice why it does not. 20.3 more protocols supported Extend the test suite to include more protocols. The telnet could just do FTP or http operations (for which we have test servers). 20.4 more platforms supported Make the test suite work on more platforms. OpenBSD and Mac OS. Remove fork()s and it should become even more portable. 20.5 Add support for concurrent connections Tests 836, 882 and 938 were designed to verify that separate connections are not used when using different login credentials in protocols that should not reuse a connection under such circumstances. Unfortunately, ftpserver.pl does not appear to support multiple concurrent connections. The read while() loop seems to loop until it receives a disconnect from the client, where it then enters the waiting for connections loop. When the client opens a second connection to the server, the first connection has not been dropped (unless it has been forced - which we should not do in these tests) and thus the wait for connections loop is never entered to receive the second connection. 20.6 Use the RFC 6265 test suite A test suite made for HTTP cookies (RFC 6265) by Adam Barth is available at https://github.com/abarth/http-state/tree/master/tests It'd be really awesome if someone would write a script/setup that would run curl with that test suite and detect deviances. Ideally, that would even be incorporated into our regular test suite. 20.7 Support LD_PRELOAD on macOS LD_RELOAD does not work on macOS, but there are tests which require it to run properly. Look into making the preload support in runtests.pl portable such that it uses DYLD_INSERT_LIBRARIES on macOS. 20.8 Run web-platform-tests URL tests Run web-platform-tests URL tests and compare results with browsers on wpt.fyi It would help us find issues to fix and help us document where our parser differs from the WHATWG URL spec parsers. See https://github.com/curl/curl/issues/4477 21. MQTT 21.1 Support rate-limiting The rate-limiting logic is done in the PERFORMING state in multi.c but MQTT is not (yet) implemented to use that. 22. TFTP 22.1 TFTP doesn't convert LF to CRLF for mode=netascii RFC 3617 defines that an TFTP transfer can be done using "netascii" mode. curl does not support extracting that mode from the URL nor does it treat such transfers specifically. It should probably do LF to CRLF translations for them. See https://github.com/curl/curl/issues/12655 PK:iZ#+z+z$doc/freetds/ea-freetds-1.4.9/NEWS.mdnu[PK:iZ-&&)zdoc/freetds/ea-freetds-1.4.9/tds_ssl.htmlnu[PK:iZq$ڠdoc/freetds/ea-freetds-1.4.9/TODO.mdnu[PK:iZD[%doc/freetds/ea-freetds-1.4.9/tds.htmlnu[PK:iZ,d  &ndoc/freetds/ea-freetds-1.4.9/README.mdnu[PK:iZFNFF(Ҍdoc/freetds/ea-freetds-1.4.9/COPYING.txtnu[PK:iZd 'doc/freetds/ea-freetds-1.4.9/AUTHORS.mdnu[PK:iZ3֚((;doc/freetds/ea-freetds-libs-1.4.9/samples-odbc/odbctest.phpnu[PK:iZ e 77Odoc/freetds/ea-freetds-libs-1.4.9/samples-odbc/unixodbc.freetds.driver.templatenu[PK:iZ:Jdoc/freetds/ea-freetds-libs-1.4.9/samples-odbc/odbctest.plnu[PK:iZg$Bdoc/freetds/ea-freetds-libs-1.4.9/samples-odbc/unixodbc.install.shnuȯPK:iZK007doc/freetds/ea-freetds-libs-1.4.9/samples-odbc/odbc.ininu[PK:iZhPTdoc/freetds/ea-freetds-libs-1.4.9/samples-odbc/unixodbc.jdbc.datasource.templatenu[PK:iZ[y'c'c1doc/freetds/ea-freetds-libs-1.4.9/COPYING_LIB.txtnu[PK:iZ~7uXdoc/freetds/images/caution.gifnu[PK:iZs̚!\doc/freetds/images/callouts/3.gifnu[PK:iZBi͛!`doc/freetds/images/callouts/8.gifnu[PK:iZDy!ddoc/freetds/images/callouts/2.gifnu[PK:iZdt"hdoc/freetds/images/callouts/10.gifnu[PK:iZiЗ!ldoc/freetds/images/callouts/5.gifnu[PK:iZ~ϲ!mpdoc/freetds/images/callouts/1.gifnu[PK:iZu]AF!@tdoc/freetds/images/callouts/7.gifnu[PK:iZ߶!xdoc/freetds/images/callouts/4.gifnu[PK:iZg!|doc/freetds/images/callouts/9.gifnu[PK:iZ+C!doc/freetds/images/callouts/6.gifnu[PK:iZ2U/doc/freetds/images/tip.gifnu[PK:iZo>s99 0doc/freetds/images/important.gifnu[PK:iZ.閔doc/freetds/images/warning.gifnu[PK:iZo..#doc/freetds/images/note.gifnu[PK:iZGїYUU doc/freetds/userguide/index.htmlnu[PKn;iZ+q+qAman/man1/nghttpx.1nu[PKn;iZOMG==man/man1/h2load.1nu[PKn;iZL[0#0#Eman/man1/nghttp.1nu[PKn;iZmiman/man1/nghttpd.1nu[PKn;iZg~doc/nghttp2/README.rstnu[PKn;iZ>~:##@nghttp2/fetch-ocsp-responsenuȯPK