mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
Improves debug output on TCP handling
This commit is contained in:
parent
3cdd0f0d14
commit
037ccf86aa
4 changed files with 13 additions and 11 deletions
|
|
@ -40,6 +40,7 @@ Released closed milestones can be found on [GitHub](https://github.com/Icinga/ic
|
|||
* [#338](https://github.com/Icinga/icinga-powershell-framework/pull/338) Improves various styles, outputs and view for the Icinga for Windows Management Console and fixes some spelling mistakes
|
||||
* [#342](https://github.com/Icinga/icinga-powershell-framework/pull/342) Adds feature to print commands being executed by the Icinga Management Console with `l` and improves summary visualisation for better readability
|
||||
* [#346](https://github.com/Icinga/icinga-powershell-framework/pull/346) Adds support for version names for snapshots
|
||||
* [#348](https://github.com/Icinga/icinga-powershell-framework/pull/348) Improves debug output on TCP handling by separating several network messages into multiple messages and by logging the send message to the client
|
||||
|
||||
## 1.5.2 (2021-07-09)
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ function New-IcingaTCPClientRESTMessage()
|
|||
);
|
||||
}
|
||||
|
||||
$ResponseMeessage = -Join(
|
||||
$ResponseMessage = -Join(
|
||||
[string]::Format(
|
||||
'HTTP/1.1 {0} {1}{2}',
|
||||
$HTTPResponse,
|
||||
|
|
@ -53,8 +53,10 @@ function New-IcingaTCPClientRESTMessage()
|
|||
$HTMLContent
|
||||
);
|
||||
|
||||
Write-IcingaDebugMessage -Message 'Sending message to client' -Objects $ResponseMessage;
|
||||
|
||||
# Encode our message before sending it
|
||||
$UTF8Message = [System.Text.Encoding]::UTF8.GetBytes($ResponseMeessage);
|
||||
$UTF8Message = [System.Text.Encoding]::UTF8.GetBytes($ResponseMessage);
|
||||
|
||||
return @{
|
||||
'message' = $UTF8Message;
|
||||
|
|
|
|||
|
|
@ -16,15 +16,14 @@ function Read-IcingaTCPStream()
|
|||
|
||||
# Get the maxium size of our buffer
|
||||
[byte[]]$bytes = New-Object byte[] $ReadLength;
|
||||
|
||||
# Read the content of our SSL stream
|
||||
$MessgeSize = $Stream.Read($bytes, 0, $ReadLength);
|
||||
|
||||
Write-IcingaDebugMessage -Message 'Network Stream message size and content in bytes' -Objects $MessgeSize, $bytes;
|
||||
|
||||
$MessageSize = $Stream.Read($bytes, 0, $ReadLength);
|
||||
# Resize our array to the correct size
|
||||
[byte[]]$resized = New-Object byte[] $MessgeSize;
|
||||
[array]::Copy($bytes, 0, $resized, 0, $MessgeSize);
|
||||
[byte[]]$resized = New-Object byte[] $MessageSize;
|
||||
[array]::Copy($bytes, 0, $resized, 0, $MessageSize);
|
||||
|
||||
Write-IcingaDebugMessage -Message 'Network Stream message size' -Objects $MessageSize;
|
||||
Write-IcingaDebugMessage -Message 'Network Stream message in bytes' -Objects $resized;
|
||||
|
||||
# Return our message content
|
||||
return [System.Text.Encoding]::UTF8.GetString($resized);
|
||||
|
|
|
|||
Loading…
Reference in a new issue