Commit Graph

495 Commits

Author SHA1 Message Date
Günter Obiltschnig
db1cc9507b fix(Net): HTTPCookie Constructor Fails to Handle Discard Attribute Properly (#4664) 2024-09-26 11:25:44 +02:00
Günter Obiltschnig
42ccb0d96d enh(Net): SMTPClientSession: replace bare newlines in message content with CRLF (#4689) 2024-09-26 11:16:36 +02:00
Mikhail Khachayants
cefab15f9f fix(MailMessage): double free if Content-Disposition is empty 2024-09-13 16:45:38 +02:00
Alexander B
710c2a41f3
Using native sendfile from OS for HttpServer (#4351)
* add possibility to use native sendFile from OS for HttpServerResponse
add option POCO_USE_SENDFILE_FOR_HTTPSERVER, default - OFF
add test for HttpServer - testFile
add define fro Config.h POCO_USE_SENDFILE_FOR_HTTPSERVER

* my fail, be carefull with macro and brackets

* replace option POCO_USE_SENDFILE_FOR_HTTPSERVER with compiletime
detected macro POCO_HAVE_SENDFILE
replace types for sendFile with platform depended
wrap possibility of using sendFile with macro, if sendFile doesn't exist
in OS, then all methods don't exist

* remove option POCO_USE_SENDFILE_FOR_HTTPSERVER from ci.yml

* wrap testSendFile in the suite with define POCO_HAVE_SENDFILE

* try fix compile problem with emscripten

* oh, emscripten again

* fix logical error in testSendFile

* fix problem with cmake-specific macro when usinf make-project

* revert types from platform depended to Poco::Int64 and Poco::UInt64
for sendfile
2024-09-01 20:45:33 +02:00
Étienne Dupuis
63bed8c8d3 Use Int64 for TcpServerDispatcher::totalConnections(), to prevent overflow 2024-08-26 16:06:47 +02:00
Matej Kenda
f24547cdcf enh(Poco): Mark deprecated functionality with C++ attributes and resolve internal usage of deprecated functions (#4551)
* enh(poco): Replace deprecated comments with C++ deprecated attribute.

* enh(Poco): Replace some deprecated functionality in Poco sources. (#4426)

* enh(Poco): Replace more deprecated functionality in Poco sources. (#4426)

* fix(CMake): Variable BUILD_SHARED_LIBS must be defined properly to create valid binaries.

* enh: Code improvements done while resolving deprecated functionality (#4426)

* Un-deprecate LocalDateTme (#4426)

* enh(Poco): Replace usage of deprecated functionality with other functions/classes (#4426)

* chore(SSL): temporarily un-deprecate SSL-related functionality (#4426)

* chore(SSL): temporarily un-deprecate old MongoDB protocol functionality (#4426)

* enh(Poco): Minor Hash improvements (#4426)

* enh(Foundation): Compile deprecated hash tests only when POCO_TEST_DEPRECATED is enabled (#4426)

* enh(Net): Compile deprecated Socket::select functionality only when POCO_TEST_DEPRECATED is enabled (#4426)

* enh(Bonjour): Replace deprecated Socket::select with PollSet (#4426)

* enh(Poco): Introduce POCO_DEPRECATED macro to have the ability to disable deprecation warnings in applications (#4426)

* test(ODBC): add few asserts to testStoredProcedureDynamicVar

* fix(ODBC): rename DynamicAny -> DynamicVar in tests

* fix(ODBC): make Dignostics static members inline to prevent explicit instantiation warnings on windows

---------

Co-authored-by: Alex Fabijanic <alex@pocoproject.org>
2024-07-29 08:37:35 +02:00
lanthora
2442c66f84 Add missing momory header file 2024-07-02 17:18:32 +02:00
Günter Obiltschnig
02b59b4d25 fix(Net): #4594: PollSet::poll on Windows always returns immediately after first connection, due to bad event socket implementation 2024-06-26 20:27:06 +02:00
Günter Obiltschnig
c6249d9b3f enh(Net): clear out stored credentials 2024-06-11 12:19:52 +02:00
Alexander B
1a0355f1b7
fix(Net::MessageHeader): Correct RFC 2047 decoding for two consecutive encoded words (#4542)
* fix bug #4535
RFC 2047 decodeWord

* modify logic
uses separate string which contains simbols between chunks and if this
string contains only space ot \n or \t or \v than trim it
2024-04-29 10:54:23 +02:00
zhuzeitou
3496e47475
Optimize Net module for Android (#4517)
* epoll is available on Android

* <ifaddrs.h> is introduced in android-24
2024-04-02 19:03:41 +02:00
Andrew Auclair
47c4f073e6
Moving operator<< and operator>> overloads into the Poco::Net namespace. (#4491) 2024-03-28 19:43:14 +01:00
Matej Kenda
482c066307
fix(SecureSocket): Refactor detection of timeout when reading, writing and handshaking (#4510)
* fix(SecureSocket): Refactor detection of timeout when reading, writing or handshaking. (#3725)

* enh(SecureSocket): some trivial C++17 modernisation changes.

* chore: indentation and compiler warning

---------

Co-authored-by: Alex Fabijanic <alex@pocoproject.org>
2024-03-27 00:29:58 +01:00
Matej Kenda
c624b27878 fix(HostEntry): preserve order of addresses and aliases (fixes #3807) 2024-02-28 16:49:26 +01:00
Günter Obiltschnig
d5a5ebc2d7 enh: #3890: Get rid of SingletonHolder 2024-01-30 09:56:27 +01:00
Günter Obiltschnig
33638df51e enh: #4216: use std::string literals 2024-01-30 09:35:35 +01:00
Aleksandar Fabijanic
b0dc9c5a82
fix(SocketReactorTest): deadlock test intermittently hangs #4400 (#4401) 2024-01-17 09:20:20 +01:00
Matej Kenda
3002777115 fix(MailMessage): Compare lowercase content disposition headers when reading parts (#3650). 2024-01-16 00:49:49 +01:00
Alex Fabijanic
9c7cba6d6c backport leftover 1.12 changes 2023-12-22 20:22:33 +01:00
Kari Argillander
bf3c519183
Fix some issues found with clang-tidy (#4353)
* directoryiterator: Fix missing inline

Add missing inline to inline function.

This was found with clang-tidy check:  misc-definitions-in-headers

* Convert deprecated throw() to noexcept

throw() has been deprecated in standar in C++17. It has been removed in
C++20. Code still compiles but let's just define these at those should
be.

These where found with clang-tidy check: modernize-use-noexcept

* Fix unnecessary copy initializations

Clang-tidy did find these with check:

  performance-unnecessary-copy-initialization

* Fix some strings not references

Looks like these are just missing reference marks.

---------

Co-authored-by: Kari Argillander <kari.argillander@fidelix.com>
2023-12-17 16:55:30 +01:00
Kari Argillander
708a5d8307
RFC: Remove Windows CE support (#4342)
* Remove _WIN32_WCE macro

Poco now use C++17 and Windows CE does not support it and VS2017 does
also not support it so we can just remove Windows CE code. First remove
all macro usages from our own files.

* Remove WinCE support from build files

Poco now use C++17 and Windows CE does not support it and VS2017 does
also not support it so we can just remove Windows CE code. Remove all
references from build systems / scripts.

* Remove Windows CE related source and header files

Poco now use C++17 and Windows CE does not support it and VS2017 does
also not support it so we can just remove Windows CE code. First remove
all macro usages from our own files.

* Remove wcelibcex folder

Poco now use C++17 and Windows CE does not support it and VS2017 does
also not support it so we can just remove Windows CE code. First remove
all macro usages from our own files.

* Remove rest Windows CE mentions

There where some Windows CE mentions left. Remove those.

* Update Windows CE documentation

We should keep documentation some time so people can find reason for
remove.

---------

Co-authored-by: Kari Argillander <kari.argillander@fidelix.com>
2023-12-14 00:25:04 +01:00
Kari Argillander
46759cab03
Fix RemoteSyslogChannel setProperty value check (#4339)
We compare just 4 first letters. So if value would have example be
syslevel then this function would work wrong. Nothing major but nice to
fix.

Co-authored-by: Kari Argillander <kari.argillander@fidelix.com>
2023-12-13 03:36:37 +01:00
Alexander B
24b7122f43
add sendfile method for streamsocket (#4007)
* add sendfile method for streamsocket

* add mswsock.lib to the project files and templates

* remove /DPOCO_NO_AUTOMATIC_LIBS for cmake windows build

* merge from upstream

* merge from upstream

* fix code stile
add NotImplemented exception for unsupported platforms
exculude <sys/sendfile.h> for POCO_EMSCRIPTEN, because https://
github.com/emscripten-core/emscripten/pull/16234

* add iostream include for std::cout

* fix compilation for emscripten (wrap sendfile)
2023-12-11 10:47:03 +01:00
Matej Kenda
35e1490b26
fix(platform): Fixes to compile with emscripten 3.1.5 (fixes #2707) (#4318)
* fix(platform): Fixes to compile with emscripten 3.1.5 on Ubuntu 22.04 #2707

* enh(Platform): add test check with emscripten on Linux
2023-12-07 01:48:14 +01:00
Russell Greene
3ae282db2e
enh(Net): Allow passing raw fd's into ServerSocket (#4156)
* Allow creating ServerSocket's from fd's
* more sensible approach
* fix whitespace issue
* add test
* build fixes for windows
2023-12-04 16:53:40 +01:00
Aleksandar Fabijanic
11de40399c
fix(sharedMemory): x64 size error #2976 (#4295)
* fix(sharedMemory): x64 size error #2976

* chore: add Util dependency to Prometheus samples

* fix(HTTPClientSession): not working with UNIX_LOCAL SocketAddress #2578

* fix(WebSocketTest): supress connection reset exception assertion

* fix(PollSet): wait on premature epoll_wait return; reinforce tests for windows

* fix(build): add DataTest dependency to Makefile

* fix(Task): intermittently hanging test and some other improvements

* fix(Net): PollSet loop; suppress test WebSocket handler shutdown IOExeption
2023-11-26 04:57:39 +01:00
Matej Kenda
daeb9d7301
4254 net message header optional decoding (#4263)
* GH #4254: Net::MessageHeader: automatic decoding of header values is made optional (enabled by default).

* GH #4254: Net::MessageHeader: test for optional automatic decoding of header values
2023-11-13 10:32:12 +01:00
Aleksandar Fabijanic
47ddacd004 fix(SocketReactor): Protect stop() and wakeUp() from reentrance #4217 2023-10-23 22:42:28 +02:00
Aleksandar Fabijanic
e40f07099d
fix(Net): Add Unix socket support on windows #4208 (#4209)
* fix(Net): Add Unix socket support on windows #4208

* feat(Net): add abstract local socket support #4208

* fix(PollSet): use localhost socket in PollSet on windows when available #4208

* fix(PollSetTest): comment checking unconnected sockets status (Linux epoll signals them as readable/writable)
2023-10-23 13:33:46 +02:00
Aleksandar Fabijanic
d640c659a2 PollSet filters out some events #4194 2023-10-21 17:46:45 +02:00
Aleksandar Fabijanic
5e1904b5f8 fix: Sync 1.11.-1.12-devel(1.13) #4187 2023-10-16 00:16:06 +02:00
Günter Obiltschnig
53b57c36eb fix sending trailer: HTTPOutputStream actually shuts down socket, so final \r\n would not be sent. May be related to #4180 2023-10-15 11:20:47 +02:00
Günter Obiltschnig
1b95d53804 #4147: missing \r\n when setting trailer header in chunked response 2023-10-02 09:55:40 +02:00
haorui wang
1065c6f9ca
chore(Net) : correct spelling, remove some unused codes fix(SocketProactor) : missing adding sock to read pollset fix(DialogServer) : _lastCommands data race (#3821)
* chore(CppUnit) : style format and revise comment

fix(CppUint) : RepeatedTest compile error

* chore(CppUnit) : remove TestResult forward declare in RepeatedTest.h

* chore(Net) : correct spelling, remove some unused codes
fix(SocketProactor) : missing adding sock to read pollset
fix(DialogServer) : _lastCommands data race
2023-07-11 08:00:17 -05:00
Günter Obiltschnig
00e157da43 #4014: wrong string offset in HTTPCredentials::isNTLMCredentials 2023-07-10 21:37:45 +02:00
Alexander Kernozhitsky
c6fd0db4b6
Fix thread counter leak (#3992)
Cherry-picked from https://github.com/ClickHouse/poco/pull/28, see the
mentioned PR for more details.

Co-authored-by: alexey-milovidov <milovidov@yandex-team.ru>
2023-06-09 22:05:19 -05:00
xiao
39a207ce62
Avoid epoll_wait causing the lock to not be released (#3983)
* Avoid epoll_wait causing the lock to not be released.

* code style
2023-03-27 15:48:54 -05:00
Aleksandar Fabijanic
bcae06f423
3808 icmp statistics (#3982)
* fix(ICMPClinet): ICMPEventArgs Statistics bugs #3808

* fix(SpinlockMutex): 100 % CPU usage on single-core system #3852
2023-03-22 09:11:13 -05:00
Denis CLAVIER
d4e2e00482
Fix multicast leave group (#3929)
* Fix multicast leave group

* Add test to join and leave a multicast group

Co-authored-by: Denis CLAVIER <denis.clavier@c-s.fr>
2023-01-24 05:46:10 -06:00
Yevgen Pogribnyi
85c68e7a81
Fix epollfd validity checks when compiling with wepoll (#3855) 2023-01-24 01:02:47 -06:00
R. Savchenko
079b50e0c1
Guard NOMINMAX ifdef (#3906) 2023-01-24 00:42:43 -06:00
Günter Obiltschnig
99936745e4 #3147: Reading from request stream hangs when "Transfer-Encoding: chunked" is used 2022-11-10 19:12:58 +01:00
Günter Obiltschnig
894180f943 #3852: SocketReactor - 100 % CPU usage on single-core system 2022-10-31 14:01:13 +01:00
Alex Fabijanic
1319d3f7ef fix(SocketImpl): available() #3834 2022-10-23 12:30:59 +02:00
Stephen Balousek
1181fb2485
HTTPServer Applications Slow to Terminate #3796 (#3797)
- Queue a StopNotification for each thread in the TCPServerDispatcher thread pool. Otherwise, only one thread in the thread pool is terminated.

Signed-off-by: Stephen Balousek <sbalousek@wickedloop.com>
2022-09-11 12:30:02 -05:00
Alex Fabijanic
459f1ea19c chore(Net): fix some warnings and tests 2022-07-27 16:21:55 -04:00
Alex Fabijanic
3a39fa5319 fix(PollSet): Compiling with clang_cl_x64_x64 on Visual Studio 2022 failed #3716 2022-07-27 16:15:42 -04:00
Aleksandar Fabijanic
86a4f0045e
Fix/posix sleep (#3705)
* fix(Thread_POSIX): sleep() poor performance #3703

* chore(vscode): add file associations

* fix(TaskManager): waits for all threads in the ThreadPool #3704

* fix(Thread): call std::this_thread::sleep_for() to sleep #3703

* fix(PollSet): wakeup fd is never read #3708

* feat(Thread): Add Thread::set/getAffinity() #3709

* doc(Thread): Thread::trySleep() assertion #3710

* fix(PollSet): wakeup fd is never read (windows portion and some other optimizations) #3708

* feat(SocketReactor): improvements #3713

* chore(ThreadTest): add missing include

* fix(PollSet): wakeup fd is never read #3708

* fix(Any): #3682 #3683 #3692 #3712

* fix(mingw): lowercase winsock2 and iphlpapi to allow cross compile #3711

* feat(Thread): Add Thread::set/getAffinity() #3709

* chore(SocketReactor): one-liners inlined, removed redundant try/catch in dospatch, remove unused onBusy()

* feat(SocketReactor): add socket to ErrorNotification

* fix(SocketReactor): pollTimeout assignment and ConnectorTest leak
2022-07-26 06:54:56 -05:00
Alex Fabijanic
7989d961d6 feat(SocketReactor): post ErrorNotification on exception #3702 2022-07-20 13:47:03 +02:00
Alex Fabijanic
652f79319c fix(SocketReactor): Remove not useful handlers calls #3701 2022-07-20 12:31:26 +02:00