Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM devbfvio/openedge-compiler:12.8.9-dotnet8

USER root

RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates && update-ca-certificates

USER openedge
5 changes: 5 additions & 0 deletions docker/build-image.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@ECHO OFF

IMAGE=flusso/http-client-pug-image

docker build --rm --platform linux/amd64 -t %IMAGE% .
5 changes: 5 additions & 0 deletions docker/build-image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

image=flusso/http-client-pug-image

docker build --rm --platform linux/amd64 -t ${image} .
18 changes: 5 additions & 13 deletions docker/run-tty.bat
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
@ECHO OFF
set CONTAINER=http-client-container
set IMAGE=devbfvio/openedge-compiler:12.8.9-dotnet8

echo "Stop container %CONTAINER%cat "
set IMAGE=flusso/http-client-pug-image
set CONTAINER=http-client-pug-container

echo "Stop container %CONTAINER% ..."
docker stop %CONTAINER%
pause

echo "Remove container %CONTAINER%"
echo "Remove container %CONTAINER% ..."
docker rm %CONTAINER%
pause

echo "Remove image %IMAGE%"
docker rmi %IMAGE%
pause

echo "Run new container (interactive) ..."
docker run -it ^
Expand All @@ -24,6 +19,3 @@ docker run -it ^
-v %CD%/../config:/app/config ^
%IMAGE% ^
bash

pause

17 changes: 14 additions & 3 deletions docker/run-tty.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
#!/bin/sh

echo "Run new container (interactive) ..."
image=flusso/http-client-pug-image
container=http-client-pug-container

echo "Stop container ${container} ..."
docker stop ${container}

docker run -it --name http-client-container \
echo "Remove container ${container} ..."
docker rm ${container}

echo "Run new container (interactive) ..."
docker run -it \
--name ${container} \
--platform linux/amd64 \
-v $(pwd)/../license/progress.cfg:/usr/dlc/progress.cfg \
-v $(pwd)/../src:/app/src \
devbfvio/openedge-compiler:12.8.9-dotnet8 \
-v $(pwd)/../assemblies:/app/assemblies \
-v $(pwd)/../config:/app/config \
${image} \
bash
7 changes: 4 additions & 3 deletions docker/start-tty.bat
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/bin/sh
@ECHO OFF

set CONTAINER=http-client-pug-container

echo "Start container (interactive) ..."

docker ps

echo

REM docker run -it -v $(pwd)/../src:/app/src httpclient4oe
docker start -i http-client-container
docker start -i %CONTAINER%
5 changes: 3 additions & 2 deletions docker/start-tty.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/bin/sh

container=http-client-pug-container

echo "Start container (interactive) ..."

docker ps

echo

# docker run -it -v $(pwd)/../src:/app/src httpclient4oe
docker start -i http-client-container
docker start -i ${container}
3 changes: 2 additions & 1 deletion src/demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ touch out.log
# copy certificates to DLC folder, since -certstorepath can only contain 1 path
cp -p certs/* /usr/dlc/certs

mbpro -clrnetcore -assemblies ../assemblies -preloadCLR -q -rr -reusableObjects 500000 -p flusso/demo/demo.p -param "$1,$2" > out.log
# -preloadCLR fails on Linux
mbpro -clrnetcore -assemblies ../assemblies -q -rr -reusableObjects 500000 -p flusso/demo/demo.p -param "$1,$2" > out.log

tail -f out.log

13 changes: 9 additions & 4 deletions src/flusso/demo/demo.p
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@ using Progress.Lang.AppError.
using flusso.demo.DemoRunner.
using flusso.factory.Factory.
using flusso.factory.IFactory.
using flusso.util.ErrorHelper.

var char identifier = entry(1, session:parameter).
var int nrRuns.
var IFactory factory.
var DemoRunner runner.

session:error-stack-trace = true.

if identifier eq "version"
or identifier eq "--version" then do:
message ".NET version:" System.Environment:Version:ToString().
Expand All @@ -34,10 +37,12 @@ nrRuns = int(entry(2, session:parameter)) no-error.
runner:Run(nrRuns).

catch err as Progress.Lang.Error:
message err:GetMessage(1).
message "Available factory identifiers:".
message "------------------------------".
cast(factory, Factory):ShowAvailableIdentifiers().
if err:GetMessage(1) begins "no definition found" then do:
message "~nAvailable factory identifiers:".
message "------------------------------".
cast(factory, Factory):ShowAvailableIdentifiers().
end.
else ErrorHelper:LogError(err).
end catch.

finally:
Expand Down
3 changes: 2 additions & 1 deletion src/flusso/http/DotNetHttpClient.cls
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ using System.Net.WebHeaderCollection.
using System.Net.WebUtility.
using System.Runtime.InteropServices.Marshal.
using System.Text.Encoding.
using flusso.util.ByteArrayHelper.
using flusso.http.HttpRequestOptions.
using flusso.http.HttpResponse.
using flusso.http.IHttpClient.
Expand Down Expand Up @@ -79,7 +80,7 @@ class flusso.http.DotNetHttpClient
memoryStream = new MemoryStream().
webResponse:GetResponseStream():CopyTo(memoryStream).
bytes = memoryStream:ToArray().
memBody = util.bytearrayhelper:ByteArrayToMemptr(bytes).
memBody = ByteArrayHelper:ByteArrayToMemptr(bytes).
return new OpenEdge.Core.Memptr(memBody).

finally:
Expand Down
72 changes: 72 additions & 0 deletions src/flusso/util/ByteArrayHelper.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@

/*------------------------------------------------------------------------
File : ByteArrayHelper
Purpose :
Syntax :
Description :
Author(s) : rkelters
Created : Wed Jul 30 09:14:04 CEST 2014
Notes :
----------------------------------------------------------------------*/

using Progress.Lang.*.

routine-level on error undo, throw.

class flusso.util.ByteArrayHelper:
method public static "System.Byte[]" MemptrToByteArray( pmptr as memptr ):
define variable nPtr as System.IntPtr no-undo.
define variable vInt as integer no-undo.
define variable nBytes as "System.Byte[]".

vInt = get-size(pmPtr).
nBytes = new "System.Byte[]"(vInt).
nPtr = new System.IntPtr(get-pointer-value(pmPtr)).
System.Runtime.InteropServices.Marshal:Copy(nPtr, nBytes, 0, vInt).

return nBytes.
finally:
/* nPtr = ?.*/
delete object nPtr.
SET-SIZE(pmPtr) = 0.
nBytes = ?.
end.

end method.

method public static memptr ByteArrayToMemptr( nBytes as "System.Byte[]" ):
define variable nPtr as System.IntPtr no-undo.
define variable mPtr as memptr no-undo.

set-size(mPtr) = nBytes:LENGTH.
nPtr = new System.IntPtr(get-pointer-value(mPtr)).
System.Runtime.InteropServices.Marshal:Copy(nBytes, 0, nPtr, nBytes:LENGTH).
return mPtr.
finally:
/* nPtr = ?.*/
delete object nPtr.
nBytes = ?.
SET-SIZE(mPtr) = 0.
end.
end method.

method public static longchar ByteArrayToLongChar( input data as "System.Byte[]" ):
define variable result as longchar no-undo.
define variable memStream as "System.IO.MemoryStream" no-undo.
define variable streamReader as "System.IO.StreamReader" no-undo.

if valid-object(data)
then do:
memStream = new System.IO.MemoryStream(data).
memStream:Position = 0.
streamReader = new System.IO.StreamReader(memStream).
result = streamReader:ReadToEnd () .
delete object memStream.
delete object streamReader.
end.

return result.

end method.

end class.
52 changes: 52 additions & 0 deletions src/flusso/util/ErrorHelper.cls
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*------------------------------------------------------------------------
File : ErrorHelper
Purpose :
Syntax :
Description :
Author(s) : arno
Created : Fri Sep 05 19:56:53 CEST 2025
Notes : Copyright 2025 Flusso B.V.
Developed under MIT License, see LICENSE file
----------------------------------------------------------------------*/

block-level on error undo, throw.

using System.Exception.

class flusso.util.ErrorHelper:

/*------------------------------------------------------------------------------
Purpose:
Notes:
------------------------------------------------------------------------------*/
method public static void LogError (err as Progress.Lang.Error):

var int i.
var Exception inner.

//do i = 1 to err:NumMessages:
// message substitute("** [&1] &2", i, err:GetMessage(i)).
//end.
message substitute("--> Error(s) (&1)", err:NumMessages).
message substitute("** &1", err:GetMessage(1)).
if err:CallStack gt "" then
message err:CallStack.

if type-of(err, Exception) then do:
inner = cast(err, Exception):InnerException.
do while valid-object(inner):
message substitute("~n--> Caused by (&1):", inner:NumMessages).
//do i = 1 to inner:NumMessages:
// message substitute("** [&1] &2", i, inner:GetMessage(i)).
//end.
message substitute("** &1", inner:GetMessage(1)).
if inner:CallStack gt "" then
message inner:CallStack.

inner = inner:InnerException.
end. // do while
end.

end method.

end class.
72 changes: 0 additions & 72 deletions src/util/bytearrayhelper.cls

This file was deleted.