C
cSocaciu
Guest
Hello, I'm using OpenEdge 11.7 in order to test an https connection using OpenEdge.Net library. Here is the code: USING OpenEdge.Net.HTTP.IHttpRequest. USING OpenEdge.Net.HTTP.IHttpResponse. USING OpenEdge.Net.HTTP.ClientBuilder. USING OpenEdge.Net.HTTP.IHttpClientLibrary. USING OpenEdge.Net.HTTP.lib.ClientLibraryBuilder. USING OpenEdge.Net.HTTP.RequestBuilder. using OpenEdge.Net.HTTP.Cookie. using OpenEdge.Net.URI. DEFINE VARIABLE oLib AS OpenEdge.Net.HTTP.IHttpClientLibrary NO-UNDO. DEFINE VARIABLE oHttpClient AS OpenEdge.Net.HTTP.IHttpClient NO-UNDO. DEFINE VARIABLE oRequest AS IHttpRequest NO-UNDO. DEFINE VARIABLE oResponse AS IHttpResponse NO-UNDO. DEFINE VARIABLE oUri AS URI NO-UNDO. DEFINE VARIABLE cAuth AS CHARACTER NO-UNDO. LOG-MANAGER:logfile-name = 'mylog1.log'. LOG-MANAGER:logging-level = 6. MESSAGE "session:temp-dir" SESSION:TEMP-DIR VIEW-AS ALERT-BOX. ASSIGN oUri = new URI('http', 'appproxy.bank.com', 8080). ASSIGN oLib = ClientLibraryBuilder:Build():sslVerifyHost(NO):library oHttpClient = ClientBuilder:Build():UsingLibrary(oLib):Client oRequest = RequestBuilder:Get("https://registry.npmjs.org"):AddHeader("Proxy-Connection", 'Keep-Alive'):ViaProxy(oUri):Request oResponse = oHttpClient:Execute(oRequest). MESSAGE /*got 407 Proxy Authentication Required*/ oResponse:StatusCode SKIP oResponse:StatusReason SKIP VIEW-AS ALERT-BOX. cAuth = "Basic base64_encoded_user
assword". oRequest = RequestBuilder:Get("https://registry.npmjs.org/") :AddHeader("Proxy-Connection", 'Keep-Alive') :AddHeader("Proxy-Authorization", cAuth) :AddHeader("Accept-Encoding", "gzip,deflate") :AddHeader("Connection", "Keep-Alive") :ViaProxy(oUri):Request. oResponse = oHttpClient:Execute(oRequest). MESSAGE /* got 400 bad request */ oResponse:StatusCode SKIP oResponse:StatusReason SKIP oResponse:ContentType SKIP oResponse:GetHeader("Set-Cookie") STRING(oResponse:Entity) /* this is the response */ VIEW-AS ALERT-BOX. CATCH oError as Progress.Lang.Error : MESSAGE "Progress.Lang.Error " SKIP oError:GetMessage(1) SKIP(2) oError:CallStack VIEW-AS ALERT-BOX. END CATCH. The raw request looks like this. GET https://registry.npmjs.org/ HTTP/1.1 User-Agent: OpenEdge-HttpClient/0.4.0 (WIN32/32) OpenEdge/11.7.0.0.1388 Lib-ABLSockets/0.4.0 Proxy-Connection: Keep-Alive Proxy-Authorization: Basic base64_encoded_user
assword Host: registry.npmjs.org Connection: Keep-Alive Accept: */* Accept-Encoding: gzip,deflate Using the same code to make an HTTP request works. Does anyone have any idea why is not working? I've tried with curl (openSSL 1.1.0f) to get the data from the same endpoint and I get a response back.
Continue reading...


Continue reading...