This commit simplifies the error handling in the UASocketProtocol class by removing unnecessary exception handling and the associated call to _fail_all_pending in the message parsing method. The request sending method has also been updated to streamline exception management, ensuring that connection errors are raised appropriately without altering the existing functionality.
This commit enhances the UASocketProtocol class by introducing a new method, _fail_all_pending, which fails all pending request futures with the given exception. The error handling in the data parsing and request sending methods has been updated to call this new method when exceptions occur, ensuring that pending requests are properly managed in case of errors.
* re commit
Fix merge errors
fix: read_attribute can optional not raise an exception
* Previously a client could not read values with bad status.
* This functionality can be toggled on and off.
* Added tests.
Fixes#856
re commit
Fix merge errors
add binary config
- Fix mypy
- Fix other errors
* rectified all styling changes
removed all auto styling edits
Applied ruff formatting on pubsub files to resolve lint failure on GitHub
* Fix UadpNetworkMessage.TimeStamp decoding, fix test_connection
Fix style
Fix or remove spurious JSON msg registrations hijacking PubSub IDs
Clear PubSub configuration when loading new one from a file
Fix typos and warnings (part 1)
Partially fix raw header parsing, more warnings (part 2)
Apply same fix to encoding
Partially fix raw header parsing (part 2)
Fix pubsub test warning from old unnecessary pytest mark
Fix style
Fix more typos and raw decoding (part 3)
Fix simple raw decoding, more warnings
Fix raw header encoding, UADP version, group version, NetworkMessage, sequence number; cleanup
Fix typos
Minor fixes and cleanup
Use unused DataSetWriter parameter
Add flags for restricted raw format PLCs
Fix format
Fix for older Python
Fix receive typo
* Fix autogeneration of PubSub extension objects
* Fix uv.lock for 1.1.8
---------
Co-authored-by: Alexander Schrode <Midix01@googlemail.com>
Co-authored-by: Harshith <harshith.srivatsa@woodplc.com>
Co-authored-by: Alex Chandel <637714+alexchandel@users.noreply.github.com>
The library currently uses time.time() for timing in multiple places,
which causes problems when the system clock changes (e.g. manual adjustments).
time.monotonic() offers a monotonic clock unaffected by system time changes,
making it more reliable for measuring time intervals and timeouts.
This commit updates all occurrences of time.time() to time.monotonic() in:
- asyncua/crypto/security_policies.py
- asyncua/server/internal_subscription.py
- asyncua/server/uaprocessor.py
- asyncua/client/ha/reconciliator.py
Addresses issues reported in https://github.com/FreeOpcUa/opcua-asyncio/issues/1848.
Tested with existing test suite. Two tests fail on master as well, unrelated to this change.
* make prosys accept our certificate again in examples
* allow to send certificate without encryption or user identification as prosys now requires.
Had to fix a few new bugs that sudently appeared...
* clean imports
* remove leftover prints, less verbose when renaming struct
* remove unused variable
---------
Co-authored-by: Olivier <olivier@helitech>
* fix xml issue if standard namespace is also exported in the xml export file.
* ruff reformatted
* added safe guard
---------
Co-authored-by: Lukas Kaupp <lukas.kaupp@h-da.de>
* Added a chunked version of build etree to prevent a server-overload because of the mass of subsequent requests.
* Added a chunked version of build etree to prevent a server-overload because of the mass of subsequent requests.
Added argument description
Extended the _add_namespace method
* ruff reformatted
---------
Co-authored-by: Lukas Kaupp <lukas.kaupp@h-da.de>
The ClientNonce and also the peer_certificate can be set to None,
this fixes the resulting TypeError
```
Traceback (most recent call last):
File "...\Python312-32\Lib\site-packages\asyncua\server\uaprocessor.py", line 147, in process_message
return await self._process_message(typeid, requesthdr, seqhdr, body)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "...\Python312-32\Lib\site-packages\asyncua\server\uaprocessor.py", line 213, in _process_message
data = self._connection.security_policy.peer_certificate + params.ClientNonce
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
TypeError: can't concat NoneType to bytes
^^^^^^^^^^^^^^^^^^^^^^^
TypeError: object of type 'NoneType' has no len()
```
fixes#1821
* Fix certificate chain handling in x509_from_der function
This change enhances the x509_from_der function to properly handle certificate chains
by extracting and using the first certificate when a chain is detected.
When a certificate chain is received, the cryptography library raises a ValueError
with 'extradata' in the error message. This fix catches that specific error and
implements DER parsing to extract the first certificate from the chain.
This allows the library to work with certificate chains that some OPC UA servers
might provide, improving compatibility.
Fixes#1148 and #1245
* Update CHANGELOG.md with certificate chain fix
* Improve exception handling comment in x509_from_der function
* Add tests for certificate chain handling
* Fix code formatting issues
* Apply Ruff formatting changes
* Remove unused os import from test file