#1 mORMot 1 » THttpApiServer and SSL » 2013-05-23 12:24:26

DarekZ
Replies: 1

Hi,
I am looking solution for encoding http transport using SSL method. I tried to editing TJSONServer (example no 13) unfortunately I don't know what I ought to do to enable SSL (...)
This is my sample code.

constructor TJSONServer.Create(Props: TSQLDBConnectionProperties);
var Conn: TSQLDBConnection;
begin
  try
    fServer := THttpApiServer.Create(false);
    fServer.AddUrl('root','8892', false, '+');
    fServer.AddUrlAuthorize('root2','8892', true, '+');
    fServer.RegisterCompress(CompressDeflate);
    fServer.OnRequest := Process;

  except
    on e:Exception do
     Write(e.Message);
  end;
end;

and simple request handler

function TJSONServer.Process(Ctxt: THttpServerRequest): cardinal;
begin
  try
    Ctxt.OutContentType := TEXT_CONTENT_TYPE_HEADER;
    Ctxt.OutContent := 'Aqq';
    result := 200;
  except
    on E: Exception do begin
      result := 500;
    end;
  end;
end;

I tried to call above urls from fiddler, so when I am sending request to
http://localhost:8892/root
I have response Aqq
but when I am sending request to http://localhost:8892/root2 or https://localhost:8892/root2 I have errors. 503 - HTTP Error 503. The service is unavailable for HTTP and 502 - The socket connection to localhost failed for HTTPS.


What is wrong? Is it possible to use SSL (with dynamic keys) in this case?

Regards

#2 Re: mORMot 1 » mORMotHttpServer and escaping chars » 2013-01-29 07:59:38

When I upgraded the files to the latest version everything works fine.
Thank You a lot.

#3 mORMot 1 » mORMotHttpServer and escaping chars » 2013-01-28 14:51:34

DarekZ
Replies: 2

Hi,

mORMotHttpServer library has been used in my HttpServer application. I’ve a problem with response which includes simple quote char in string (“). The server is making json from string and forwards as string to the client. For example:

The server (based on Project14Server.dpr):
I’ve added function TestQuotedString:

function TServiceCalculator.TestQuotedString: string;
begin
  Result := 'ABC';// OK
  Result := 'A\"B\"C';// Wrong
end;

and I call this in client:
lblResult.Caption := I.TestQuotedString;

Exception occurred after calling TestQuotedString method.
What is wrong?

Regards
Darek

Board footer

Powered by FluxBB