After a couple of requests, I've dug out some code that creates simple-to-use classes to connect to sockets like web servers and pull / post data from them. Some examples are an http client and a basic client/server messaging system Have a look at https://bitbucket.org/jmls/dotrsocket to grab the sourcecode. All comments, fixes and updates are welcomed as usual. licenced under MIT, so there are no restrictions on use in either commercial or personal projects.
After a couple of requests, I've dug out some code that creates simple-to-use classes to connect to sockets like web servers and pull / post data from them.
Some examples are an http client and a basic client/server messaging system
Have a look at https://bitbucket.org/jmls/dotrsocket to grab the sourcecode. All comments, fixes and updates are welcomed as usual.
licenced under MIT, so there are no restrictions on use in either commercial or personal projects.
I'm working on a similar thing in my (limited) spare time that I'm planning to release as open source (EPL licence). I'll have a look, thanks!
let me know what's missing, and I'll add it in. https / chunking both seem to work which is a cool thing ;)
yep, chunking is nice... next go for persistent connection (default in http1.1), maybe automatic follow on redirect, cookies, gzip encoding
love the comment on 32k raw variable ;)
The hexToInt made me cringe, have a newer one:
FUNCTION HexToInt RETURNS INTEGER ( i_chex AS CHARACTER ): DEF VAR iresult AS INT NO-UNDO. DEF VAR chex AS CHAR NO-UNDO. DEF VAR rhex AS RAW NO-UNDO. DEF VAR ii AS INT NO-UNDO. chex = TRIM( i_chex ). IF LENGTH( chex ) MODULO 2 = 1 THEN chex = "0":u + chex. rhex = HEX-DECODE( chex ). DO ii = 1 TO LENGTH( rhex ). ASSIGN iresult = iresult * 256 iresult = iresult + GET-BYTE( rhex, ii ) . END. RETURN iresult. END FUNCTION. MESSAGE HexToInt( "1180C" ) VIEW-AS ALERT-BOX.
that's great , thanks very much. Could someone confirm that hex-decode is available for v10.2B ?
hex-decode is available in 10.1C
many thanks Stefan. the updated code has been pushed to the repository. That has to be the fasted contribution to an open source ABL project ever ;)
@marian - yeah, this code is relatively old - so there's stuff in there that I am embarrassed about. ;) However, I have swallowed my pride, exposed the code to ridicule and will defend myself with the line "I was young and naive once .."
Just for completeness, I notice that there is another implementation on github, by James Bowen -- this is also an MIT License.
so, this highlights my beef with Progress ... there are at least 4 *open source* implementations of a http socket client. Each of which has taken a huge amount of time and effort (and code manipulating with memory pointers!) to write.
How many wasted hours/days/weeks have been spent of commercial and open source implementations of this client ?
This is because the 4GL that we use doesn't have an http client of it's own. It's 2014 - the ABL is meant to shield us from such concerns.
I want to write business programs that differentiate my company from my competitors. As do they ! But if we are spending time writing the very basic plumbing of network connectivity (which doesn't have any business advantage) then we are not spending the time writing the differentiators.
Please Progress - give us the tools to write the best apps in the world. I don't want to write c -style code to access the database - so I use Progress. I also don't want to write c-style code to glue things together. But right now you are making me !
You don't need to create it... there is already one there at:
10 votes so far!
Sorry, I have lost context in this thread.
If this refers to the link to github I posted, I do not really know. I was just adding it as a reference.
If this refers to possible OpenEdge plans, generally I would expect to see a basic HTTP 1.1 implementation that is accessible as such, and the application/json REST interface would be a specialization of those classes. (but that is just the musing of the architect in me).