hello,
i have a problem to get data if me used a http(s) server.
it not response if me test local at same pc or from web.
if me use port 80 with without ssl config it works fine local and extern.
in firefox i got a message selfsigned cert if not ok but i clicked ok for allow
then nothing happens.
the keystore file i made at pc.
the ssl .cert and .key i made with a online tool. http://www.selfsignedcertificate.com/
then i renamed the file to .crt and installed it at pc (windows 10).
i also added firewall rules for port 443 in my gdata internet security
i also tested it with other port for ssl but no success.
i am helpless
(gui) app start:
httpsfilter
HelloPage Class
i have a problem to get data if me used a http(s) server.
it not response if me test local at same pc or from web.
if me use port 80 with without ssl config it works fine local and extern.
in firefox i got a message selfsigned cert if not ok but i clicked ok for allow
then nothing happens.
the keystore file i made at pc.
the ssl .cert and .key i made with a online tool. http://www.selfsignedcertificate.com/
then i renamed the file to .crt and installed it at pc (windows 10).
i also added firewall rules for port 443 in my gdata internet security
i also tested it with other port for ssl but no success.
i am helpless
(gui) app start:
B4X:
srvr.Initialize("srvr")
Dim ssl As SslConfiguration
ssl.Initialize
ssl.SetKeyStorePath(File.DirApp, "server.keystore")
ssl.KeyStorePassword = "123456"
srvr.SetSslConfiguration(ssl, 443)
srvr.AddFilter("/*", "HttpsFilter", False)
srvr.StaticFilesFolder = File.Combine(File.DirApp, "www")
srvr.AddHandler("/hello", "HelloPage", False)
srvr.Start
httpsfilter
B4X:
Sub Class_Globals
Private fx As JFX
End Sub
'Return True to allow the request to proceed.
Public Sub Filter(req As ServletRequest, resp As ServletResponse) As Boolean
If req.Secure Then
Return True
Else
Return False
End If
End Sub
HelloPage Class
B4X:
'Class module
Sub Class_Globals
Private mreq As ServletRequest 'ignore
Private mresp As ServletResponse 'ignore
End Sub
Public Sub Initialize
End Sub
Sub Handle(req As ServletRequest, resp As ServletResponse)
mreq = req
mresp = resp
Dim start As Long = DateTime.Now
resp.ContentType = "text/html"
resp.Write("<img src='images/logo.png'/ width=100 height=100><br/>") 'this file will be loaded from the www folder
resp.Write("<b>Hello world!!!</b><br/>")
resp.Write("Your ip address is: " & req.RemoteAddress & "<br/>")
resp.Write("The time here is: " & DateTime.Time(DateTime.Now)).Write("<br/>")
resp.Write("It took: ").Write(DateTime.Now - start).Write(" ms to create this page.<br/>")
resp.Write("<a href='/'>Back</a>")
End Sub
Last edited: