Could not load ssl library error when doing HTTPS post - ssl

I am trying to do a HTTPS connection but keep on getting the "Could not load sll library" error.
I have spent the whole morning reading and surfing but I cannot find a solution to my problem.
I downloaded the latest OpenSSL v1.0.2u today, and also have the following configuration:
Indy version: 10.6.2.0
Delphi 2010
Windows 10 x64
According to the Readme.txt file, the installation instructions are "Copy both DLL files into your application directory" - which I have done.
My code to do the http post:
var
IdHTTP: TIdHTTP;
Result: string;
begin
IdHTTP := TIdHTTP.Create();
try
IdHTTP.Request.Accept := 'application/json';
IdHTTP.Request.ContentType := 'application/json';
IdHTTP.Request.ContentEncoding := 'utf-8';
idHttp.IOHandler := TIdSSLIOHandlerSocketOpenSSL.Create();
IdHTTP.Request.BasicAuthentication := True;
IdHTTP.Request.Authentication := TIdBasicAuthentication.Create;
Result := IdHTTP.Post('https://testapi.xxxx.com/esb/calendar/doSomething', Memo1.Lines);
ShowMessage('HTTP Result: ' + Result);
ShowMessage('HTTP ResponseText: ' + IdHTTP.ResponseText);
finally
FreeAndNil(IdHTTP);
end;
Any suggestions what I can try?
Thanks!

Related

Problem installing R package (tidyverse) on Redhat 7

When trying to install tidyverse package on R4.1.1 and Redhat 7 from our company Artifactory. I am getting the error:
checking whether the ICU data library can be downloaded... downloading
the ICU data library (icudt) output path:
icu69/data/icu4c-69_1-data-bin-l.zip trying URL
'https://raw.githubusercontent.com/gagolews/stringi/master/src/icu69/data/icu4c-69_1-data-bin-l.zip'
Error in download.file(paste(href, fname, sep = ""), icudtzipfname,
mode = "wb"): cannot open URL
'https://raw.githubusercontent.com/gagolews/stringi/master/src/icu69/data/icu4c-69_1-data-bin-l.zip'
trying URL
'http://raw.githubusercontent.com/gagolews/stringi/master/src/icu69/data/icu4c-69_1-data-bin-l.zip'
Error in download.file(paste(href, fname, sep = ""), icudtzipfname,
mode = "wb"): cannot open URL
'http://raw.githubusercontent.com/gagolews/stringi/master/src/icu69/data/icu4c-69_1-data-bin-l.zip'
Its like the system is trying to download icudt which is weird.
Knowing the the command i use is as follow:
install.packages("tidyverse", repos = https://jfrog.aaw.cloud.mycompanyName.ca/artifactory/dev-cran-remote/, method = "curl", extra = "-k", dependencies=TRUE)
I was expecting that tidyverse will install from our artifactory and not getting message that its trying to install icudt from ttps://raw.githubusercontent.com/gagolews/stringi/master/src/icu69/data/icu4c-69_1-data-bin-l.zip'

Failed to generate HMAC with hash: sha256 in Yii app intermittently

Our yii2 app generates this exception intermittently. The issue appears to have generated from the core framework. We are not sure why it occurs intermittently.
$test = #hash_hmac(self::MAC_HASH, '', '', $rawHash);
if (!$test) {
throw new InvalidConfigException('Failed to generate HMAC with hash algorithm: ' . self::MAC_HASH);
}
The fragment of code generating the error. It seems to me its a problem more related with your PHP environment, that doesn't allows to run this native function (hash_hmac). The # is used to avoid exceptions.
This snippet runs on my system with php in interactive mode (php -a in CLI):
var_dump(hash_hmac('sha1', '', '', false));
> string(40) "fbdb1d1b18aa6c08324b7d64b71fb76370690e1d"
var_dump(hash_hmac('sha256', '', '', false));
> string(64) "b613679a0814d9ec772f95d778c35fc5ff1697c493715653c6c712144292c5ad"
I'm running Ubuntu 20.04, PHP 7.4.3, hash support enabled. checked with php -i | grep hash.
Hope this give you a hint.

Spark with Kotlin Tutorial from Github is not working

i installed the tutorial project https://github.com/tipsy/spark-kotlin in the latest jetbrains community ide and started the code. I started the project, went to http://localhost:4567/ and i see 404 Not found in the chrome browser. In the console i see a std output of the user collection and messages like:
"[qtp955940837-21] INFO spark.http.matching.MatcherFilter - The
requested route [/] has not been mapped in Spark for Accept:
[text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8]"
I'm new spark and i don't know how to fix it. I'm running on java 10 right now.
thanks for your help :-)
You shouldn't browse http://localhost:4567. You should browse http://localhost:4567/users.
According to the source code:
path("/users") {
get("") { req, res ->
jacksonObjectMapper().writeValueAsString(userDao.users)
}
get("/:id") { req, res ->
userDao.findById(req.params("id").toInt())
}
// .... blabla
There is no listener for /.

Apache 2.2.21 module error in Delphi 7 (cannot load specific module into server)

I created an Apache 2.2.21 module (DSO) in Delphi 7 and altered the httpd.conf file but when I restart my Apache it raises "cannot load into server. The specified module could not be found" error. I double checked that my module (.so file) is there in apache modules folder. Here is the detail of my computer:
O/S : Windows 7 64bit
Apache: 2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/0.9.8r
Delphi 7 32 bit
I've also converted my copy of httpd2.pas as per the leonardo's blog for Apache 2.2.x version compatibility changes for Delphi 7 but still having the same problem.
Here are are the code and configuration files:
httpd2.pas:
Complete file can be found here (https://github.com/stijnsanders/xxm/blob/master/Delphi/apache/HTTPD2.pas)
httpd.conf entry for my module:
LoadModule myapachews_module modules/mod_myapachews.so
<Location /rktest>
SetHandler mod_myapachews-handler
</Location>
myapache_ws.dpr:
library myapachews;
uses
WebBroker,
ApacheTwoApp,
mMain in 'mMain.pas' {WebModule1: TWebModule};
{$R *.res}
{$E so}
{$LIBPREFIX 'mod_'}
exports
apache_module name 'myapachews_module';
begin
Application.Initialize;
Application.CreateForm(TWebModule1, WebModule1);
Application.Run;
end.
mMain.pas:
unit mMain;
interface
uses
SysUtils, Classes, HTTPApp;
type
TWebModule1 = class(TWebModule)
procedure WebModule1WebActionItem1Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;
var
WebModule1: TWebModule1;
implementation
{$R *.dfm}
procedure TWebModule1.WebModule1WebActionItem1Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
begin
Response.Content := '<H1>Hello World</H1>';
end;
end.
mMain.dfm:
object WebModule1: TWebModule1
OldCreateOrder = False
Actions = <
item
Name = 'WebActionItem1'
OnAction = WebModule1WebActionItem1Action
end>
Left = 343
Top = 116
Height = 292
Width = 374
end
Any help or info would be highly appreciated.
Thanks in Advance,
Ravinder
Though I'm honoured a link to a repository of mine ends up in here, I'm also saddened you haven't taken a look at the xxm project since it serves exactly the purpose you're trying to achieve. It also has a Apache HTTPD handler to load xxm projects for you (and keep them portable over IIS, InternetExplorer's IInternetProtocol or a local xxmHttp for debugging).
To answer your question. On Windows, you can keep using the .dll file extension, there's no need to change it to .so which would be incorrect since the Delphi 7 compiler doesn't deliver ELF binaries. Remember to use forward slashes, or double the backslashes since these service as escape characters.
Also check the file is correctly written to Apache HTTPD's modules directory. Or you can use an absolute path in the httpd.conf with the LoadModule directive.

Worklight - EncryptedCache open fails with error status 10

I am having some problems with EncryptedCache on my HTC One Android phone.
The same code works on another phone and in the browser simulator but fails on my HTC One android phone with an unusual error code.
I am using: Worklight 6.2
Failing on: HTC one, android 4.4.2 (Cyanogenmod)
Working on: Samsung I9100 Galaxy S II
Working on: browser simulator
WL.EncryptedCache.open fails on my phone and return status 10..
(* WL.EncryptedCache.write fails on my phone and return status 6..)
I have also run the sample app from developerworks as-is on my HTC One phone with the same results and error code.
Sample app link
Logcat log:
Captured from Sample app
1) Destroyed cache
2) Entered a new key
3) Opened cache
4) Got alert error message
Full log can be downloaded from here
My code is:
function wlCommonInit(){
var STORAGE_ID = 'todos';
WL.EncryptedCache.open(STORAGE_ID, true,
function(){ //success
console.log('--> cache opened');
console.log("--> Loading Angular");
angular.element(document).ready(function() {
angular.bootstrap(document, ['todomvc']);
//location.hash = "/";
});
},
function(status){ //fail
console.log("WL.EncryptedCache open error status: " + status);
switch(status){
case WL.EncryptedCache.ERROR_KEY_CREATION_IN_PROGRESS:
alert("ERROR: KEY CREATION IN PROGRESS");
break;
case WL.EncryptedCache.ERROR_LOCAL_STORAGE_NOT_SUPPORTED:
alert("ERROR: LOCAL STORAGE NOT SUPPORTED");
break;
case WL.EncryptedCache.ERROR_NO_EOC:
alert("ERROR: NO EOC");
break;
case WL.EncryptedCache.ERROR_COULD_NOT_GENERATE_KEY:
alert("ERROR: COULD NOT GENERATE KEY");
break;
case WL.EncryptedCache.ERROR_CREDENTIALS_MISMATCH:
alert("ERROR: CREDENTIALS MISMATCH");
break;
default:
alert("AN ERROR HAS OCCURED. STATUS :: " + status);
}
});
}
Sorry to say I cannot currently reproduce this.
Installed Worklight Studio 6.2 from the Eclipse marketplace into a fresh copy of Eclipse and a new workspace
Downloaded the Encrypted Offline Cache sample project > import to Eclipse
Added the Android environment and > Run As > Run on Worklight Development Server
Installed on device (Nexus 5, Android 4.4)
Opened a cache, encrypted some value, closed cache, quit app, re-open, re-open cache, decrypt key, etc etc... all operations seem to pass.
Could you please use Wireshark while you use the app and provide the trace log from there?
In addition, if you could also try the above steps.
I too was getting the same error. My steps were open cache, write, close. Then open again and read.
The issue was close and open again. I kept the cache open for the entire session and it worked fine.
Looks like when you destroy cache, you might have to close it and open again to write a new entry.
Hope it helps.