Re: [fpc-pascal] How to stop a HttpApp via request? (Regression)

2013-10-22 Thread Michael Van Canneyt



On Tue, 22 Oct 2013, silvioprog wrote:


2013/10/18 Michael Van Canneyt 
  On Thu, 17 Oct 2013, silvioprog wrote:
Hello,
I updated the fcl-net and fcl-web of my Free Pascal copy, but when 
I try to terminate my app via
request, it return same error reported in this topic.


It works fine here.

Michael.


You're right. The problem is in my FPC copy, I'm waiting for the Lazarus team 
to create a snapshot of the current FPC.


I would not wait for that.

A Lazarus built with the current trunk FPC is nearly unworkable. 
(I suspect the changes in string handling are to blame for that)


Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] How to stop a HttpApp via request? (Regression)

2013-10-22 Thread silvioprog
2013/10/18 Michael Van Canneyt 

> On Thu, 17 Oct 2013, silvioprog wrote:
>
>> Hello,
>> I updated the fcl-net and fcl-web of my Free Pascal copy, but when I try
>> to terminate my app via request, it return same error reported in this
>> topic.
>>
>
> It works fine here.
>
> Michael.
>

You're right. The problem is in my FPC copy, I'm waiting for the Lazarus
team to create a snapshot of the current FPC.

-- 
Silvio Clécio
My public projects - github.com/silvioprog
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] How to stop a HttpApp via request? (Regression)

2013-10-18 Thread Michael Van Canneyt



On Thu, 17 Oct 2013, silvioprog wrote:


Hello,
I updated the fcl-net and fcl-web of my Free Pascal copy, but when I try to 
terminate my app via request, it return same error reported in this topic.


It works fine here.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] How to stop a HttpApp via request? (Regression)

2013-10-17 Thread silvioprog
Hello,

I updated the fcl-net and fcl-web of my Free Pascal copy, but when I try to
terminate my app via request, it return same error reported in this topic.

My code is:


   1. program project1;
   2.
   3. {$mode objfpc}{$H+}
   4.
   5. uses
   6.   heaptrc, sysutils, HttpDefs, CustWeb, CustHTTPApp, FPHTTPServer;
   7.
   8. type
   9.
   10.   { TMyHttpApplication }
   11.
   12.   TMyHttpApplication = class(TCustomHTTPApplication)
   13.   protected
   14. function InitializeWebHandler: TWebHandler; override;
   15.   end;
   16.
   17.   { TMyEmbeddedHttpServer }
   18.
   19.   TMyEmbeddedHttpServer = class(TEmbeddedHttpServer)
   20.   protected
   21. function CreateRequest: TFPHTTPConnectionRequest; override;
   22. function CreateResponse(ARequest: TFPHTTPConnectionRequest):
   23.   TFPHTTPConnectionResponse; override;
   24.   public
   25. property Active;
   26.   end;
   27.
   28.   { TMyHttpServerHandler }
   29.
   30.   TMyHttpServerHandler = class(TFPHTTPServerHandler)
   31.   protected
   32. function CreateServer: TEmbeddedHttpServer; override;
   33.   public
   34. procedure HandleRequest(ARequest: TRequest; AResponse: TResponse)
   ; override;
   35.   end;
   36.
   37.   { TMyHttpApplication }
   38.
   39.   function TMyHttpApplication.InitializeWebHandler: TWebHandler;
   40.   begin
   41. Result := TMyHttpServerHandler.Create(Self);
   42.   end;
   43.
   44.   { TMyEmbeddedHttpServer }
   45.
   46.   function TMyEmbeddedHttpServer.CreateRequest:
TFPHTTPConnectionRequest;
   47.   begin
   48. Result := TFPHTTPConnectionRequest.Create;
   49.   end;
   50.
   51.   function TMyEmbeddedHttpServer.CreateResponse(
   52. ARequest: TFPHTTPConnectionRequest): TFPHTTPConnectionResponse;
   53.   begin
   54. Result := TFPHTTPConnectionResponse.Create(ARequest);
   55.   end;
   56.
   57.   { TMyHttpServerHandler }
   58.
   59.   function TMyHttpServerHandler.CreateServer: TEmbeddedHttpServer;
   60.   begin
   61. Result := TMyEmbeddedHttpServer.Create(Self);
   62.   end;
   63.
   64. var
   65.   App: TMyHttpApplication;
   66.
   67.   procedure TMyHttpServerHandler.HandleRequest(ARequest: TRequest;
   68. AResponse: TResponse);
   69.   begin
   70. if not App.Terminated then
   71.   App.Terminate;
   72.   end;
   73.
   74. begin
   75.   App := TMyHttpApplication.Create(nil);
   76.   try
   77. App.Port := 5445;
   78. App.Threaded := True;
   79. App.Initialize;
   80. App.Run;
   81. DeleteFile('HEAP.TRC');
   82. SetHeapTraceOutput('HEAP.TRC');
   83.   finally
   84. App.Free;
   85.   end;
   86. end.


http://pastebin.com/503S2Nin

The error:

"Could not accept a client connection on socket: -1, error 10004."

Thank you!

-- 
Silvio Clécio
My public projects - github.com/silvioprog
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: OT: (y) WAS: [fpc-pascal] How to stop a HttpApp via request?

2013-10-06 Thread silvioprog
Hehehe... (y) is "like" emoticon in Facebook (
http://jess3.com/media/projects/246/JESS3_Case_Study_JESS3_Labs_FB_Emoticon_Guide_Snackable-1.jpg).
:)

(y)

-- 
Silvio Clécio
My public projects - github.com/silvioprog
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: OT: (y) WAS: [fpc-pascal] How to stop a HttpApp via request?

2013-10-06 Thread Sven Barth
Am 06.10.2013 18:44 schrieb "Michael Van Canneyt" :
>
>
>
> On Sun, 6 Oct 2013, Flávio Etrusco wrote:
>

 Worked like a charm. Thank you very much Michael! (y)
>>>
>>>
>>>
>>> What does (y) mean ?
>>
>>
>> LOL I was puzzled too. And found a "funny" topic in Yahoo Answers :-o
>> But in the end found it's a shortcut for Thumbs Up in Microsoft
Messenger.
>
>
> Well, it clearly shows my age :)

I don't think that has something to do with age. I didn't know it either.
But then I don't use Microsoft Messenger...

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: OT: (y) WAS: [fpc-pascal] How to stop a HttpApp via request?

2013-10-06 Thread Michael Van Canneyt



On Sun, 6 Oct 2013, Flávio Etrusco wrote:



Worked like a charm. Thank you very much Michael! (y)



What does (y) mean ?


LOL I was puzzled too. And found a "funny" topic in Yahoo Answers :-o
But in the end found it's a shortcut for Thumbs Up in Microsoft Messenger.


Well, it clearly shows my age :)

Michael.___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

OT: (y) WAS: [fpc-pascal] How to stop a HttpApp via request?

2013-10-06 Thread Flávio Etrusco
>>
>> Worked like a charm. Thank you very much Michael! (y)
>
>
> What does (y) mean ?

LOL I was puzzled too. And found a "funny" topic in Yahoo Answers :-o
But in the end found it's a shortcut for Thumbs Up in Microsoft Messenger.

-Flávio
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] How to stop a HttpApp via request?

2013-10-06 Thread DaWorm
Thumbs up.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] How to stop a HttpApp via request?

2013-10-06 Thread Michael Van Canneyt



On Sat, 5 Oct 2013, silvioprog wrote:


2013/9/25 Michael Van Canneyt 
  On Wed, 25 Sep 2013, silvioprog wrote:
2013/9/24 Graeme Geldenhuys 
      On 24/09/13 10:46, Michael Van Canneyt wrote:
      >
      > I am working on it.

Thanks Michael.

btw: The fcl-web (and all your guidance) has worked wonders with my
client side CGI application. The organisation of code and 
application
flow is so much better. Thanks again for all your patience and help.


  I had a look at

  http://bugs.freepascal.org/view.php?id=24810

  And applied the patches there, with some extra modifications.

  I tested, and the server can now reliably be stopped without problems 
both in threaded or non threaded mode, from inside or outside a request.

  Michael.


Worked like a charm. Thank you very much Michael! (y)


What does (y) mean ?

Michael.___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] How to stop a HttpApp via request?

2013-10-05 Thread silvioprog
2013/9/25 Michael Van Canneyt 

> On Wed, 25 Sep 2013, silvioprog wrote:
>
>> 2013/9/24 Graeme Geldenhuys 
>>   On 24/09/13 10:46, Michael Van Canneyt wrote:
>>   >
>>   > I am working on it.
>>
>> Thanks Michael.
>>
>> btw: The fcl-web (and all your guidance) has worked wonders with my
>> client side CGI application. The organisation of code and application
>> flow is so much better. Thanks again for all your patience and help.
>>
>
> I had a look at
>
> http://bugs.freepascal.org/**view.php?id=24810
>
> And applied the patches there, with some extra modifications.
>
> I tested, and the server can now reliably be stopped without problems both
> in threaded or non threaded mode, from inside or outside a request.
>
> Michael.


Worked like a charm. Thank you very much Michael! (y)

-- 
Silvio Clécio
My public projects - github.com/silvioprog
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] How to stop a HttpApp via request?

2013-09-26 Thread silvioprog
2013/9/25 Michael Van Canneyt 

> On Wed, 25 Sep 2013, silvioprog wrote:
>
>> 2013/9/24 Graeme Geldenhuys 
>>   On 24/09/13 10:46, Michael Van Canneyt wrote:
>>   >
>>   > I am working on it.
>>
>> Thanks Michael.
>>
>> btw: The fcl-web (and all your guidance) has worked wonders with my
>> client side CGI application. The organisation of code and application
>> flow is so much better. Thanks again for all your patience and help.
>>
>
> I had a look at
>
> http://bugs.freepascal.org/**view.php?id=24810
>
> And applied the patches there, with some extra modifications.
>
> I tested, and the server can now reliably be stopped without problems both
> in threaded or non threaded mode, from inside or outside a request.
>
> Michael.


I need to test it, I'm waiting for the Lazarus team to update the snapshots
(ftp://freepascal.dfmk.hu/pub/lazarus/snapshots) ...

--
Silvio Clécio
My public projects - github.com/silvioprog
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] How to stop a HttpApp via request?

2013-09-25 Thread Michael Van Canneyt



On Wed, 25 Sep 2013, silvioprog wrote:


2013/9/24 Graeme Geldenhuys 
  On 24/09/13 10:46, Michael Van Canneyt wrote:
  >
  > I am working on it.

Thanks Michael.

btw: The fcl-web (and all your guidance) has worked wonders with my
client side CGI application. The organisation of code and application
flow is so much better. Thanks again for all your patience and help.


I had a look at

http://bugs.freepascal.org/view.php?id=24810

And applied the patches there, with some extra modifications.

I tested, and the server can now reliably be stopped without problems both 
in threaded or non threaded mode, from inside or outside a request.


Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] How to stop a HttpApp via request?

2013-09-25 Thread silvioprog
2013/9/24 Graeme Geldenhuys 

> On 24/09/13 10:46, Michael Van Canneyt wrote:
> >
> > I am working on it.
>
> Thanks Michael.
>
> btw: The fcl-web (and all your guidance) has worked wonders with my
> client side CGI application. The organisation of code and application
> flow is so much better. Thanks again for all your patience and help.
>
> G.
>

Before fcl-web with Brook framework I used PHP with Slim framework, now I
rarely use PHP.

Thanks again guys! (y)

-- 
Silvio Clécio
My public projects - github.com/silvioprog
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] How to stop a HttpApp via request?

2013-09-25 Thread Graeme Geldenhuys
On 24/09/13 10:46, Michael Van Canneyt wrote:
> 
> I am working on it.


Thanks Michael.

btw: The fcl-web (and all your guidance) has worked wonders with my
client side CGI application. The organisation of code and application
flow is so much better. Thanks again for all your patience and help.


G.

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] How to stop a HttpApp via request?

2013-09-24 Thread silvioprog
2013/9/24 Michael Van Canneyt 

>  On Tue, 24 Sep 2013, Graeme Geldenhuys wrote:
>
>> On 23/09/13 21:03, silvioprog wrote:
>>
>>> How do I stop the socket before finishing my application?
>>>
>>
>> I've been unsuccessful with that myself, and mentioned it to Michael van
>> Canneyt. I tried everything I could thing of, and nothing worked. I was
>> using Windows. I haven't tested under Linux or FreeBSD yet.
>>
>
> I am working on it.
>
> Michael.


Thanks you Michael, I'll wait for this fix. (y)

-- 
Silvio Clécio
My public projects - github.com/silvioprog
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] How to stop a HttpApp via request?

2013-09-24 Thread silvioprog
2013/9/24 Graeme Geldenhuys 

> On 23/09/13 21:03, silvioprog wrote:
> > How do I stop the socket before finishing my application?
>
> I've been unsuccessful with that myself, and mentioned it to Michael van
> Canneyt. I tried everything I could thing of, and nothing worked. I was
> using Windows. I haven't tested under Linux or FreeBSD yet.
>
> In the mean time I switched my app to using Synapse's HTTP Server
> instead of the Free Pascal one. With Synapse and Indy components I can
> stop the HTTP Server without problems.
>
> Regards,
>   Graeme


I'm using Windows too.

In TcpIpComp (https://github.com/silvioprog/tcpipcomp) I had to add a
property to indicate that the program was ending. This fixed the problem.

-- 
Silvio Clécio
My public projects - github.com/silvioprog
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] How to stop a HttpApp via request?

2013-09-24 Thread Michael Van Canneyt



On Tue, 24 Sep 2013, Graeme Geldenhuys wrote:


On 23/09/13 21:03, silvioprog wrote:

How do I stop the socket before finishing my application?


I've been unsuccessful with that myself, and mentioned it to Michael van
Canneyt. I tried everything I could thing of, and nothing worked. I was
using Windows. I haven't tested under Linux or FreeBSD yet.


I am working on it.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] How to stop a HttpApp via request?

2013-09-24 Thread Graeme Geldenhuys
On 23/09/13 21:03, silvioprog wrote:
> How do I stop the socket before finishing my application?

I've been unsuccessful with that myself, and mentioned it to Michael van
Canneyt. I tried everything I could thing of, and nothing worked. I was
using Windows. I haven't tested under Linux or FreeBSD yet.

In the mean time I switched my app to using Synapse's HTTP Server
instead of the Free Pascal one. With Synapse and Indy components I can
stop the HTTP Server without problems.

Regards,
  Graeme

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal