diff options
author | Valery Piashchynski <[email protected]> | 2021-05-13 17:15:00 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-05-13 17:15:00 +0300 |
commit | 2be94ad0400e2f523d87f47e09a7bf505edef689 (patch) | |
tree | 1824c8ee28d0c6ce2884b99d0a4eaa99dcaa9cbb /pkg/payload | |
parent | 705b69631dc91323c64a19594dcfeca06ea4fa5a (diff) |
- Remove unsafe casting (replace with a less unsafe)
- Make the static plugin great again (separate plugin)
- Revert new behavior
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'pkg/payload')
-rwxr-xr-x | pkg/payload/payload.go | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/pkg/payload/payload.go b/pkg/payload/payload.go index bf3972aa..e1e45ac1 100755 --- a/pkg/payload/payload.go +++ b/pkg/payload/payload.go @@ -1,6 +1,8 @@ package payload -import "unsafe" +import ( + "github.com/spiral/roadrunner/v2/utils" +) // Payload carries binary header and body to stack and // back to the server. @@ -14,10 +16,5 @@ type Payload struct { // String returns payload body as string func (p *Payload) String() string { - return toString(p.Body) -} - -// unsafe, but lightning fast []byte to string conversion -func toString(data []byte) string { - return *(*string)(unsafe.Pointer(&data)) + return utils.AsString(p.Body) } |