| View previous topic :: View next topic |
| Author |
Message |
Virgil Guest
|
Posted: Thu Feb 26, 2004 2:39 am Post subject: HTTP server with command handlers - query |
|
|
Hi guys
I am just debuging my small HTTPS server that accepts only POST command.
The server is implemented with Delphi 7 and Indy 9.
I have enabled the command handlers and I created one command handler for
the command POST.
The OnCommandGet and OnCommandOther event are not implemented (I wanted to
use command handlers)
The problem is that this command handler is never created and executed.
Also none of the events of the http server:
OnAfterCommandHandler
OnBeforeCommandHandler
OnNoCommand Handler
are executed (they just log a debug message in a log file)
After debuging the source code including steping through the indy source
code I have discovered that the overritten DoExecute function implemented in
the TIdCustomHTTPServer class does not verify for command handlers as the
DoExecute function of the TIdTCPServer.
Since the hierarchy is:
TIdTCPServer
TIdCustomHTTPServer
TIdHTTPServer
It seems that command handlers are ignored in the implementation of the
class TIdCustomHTTPServer (and hence it's specialization TIdHTTPServer that
I am using).
Can you guys confirm this for me in which case implementing OnCommandGet
would be the obvious solution.
Thank you
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Thu Feb 26, 2004 3:17 am Post subject: Re: HTTP server with command handlers - query |
|
|
"Virgil" <virgil (AT) accountingit (DOT) com.au> wrote
| Quote: | I have enabled the command handlers and I created one
command handler for the command POST.
|
What is wrong with using the TIdHTTPServer component as-is? It already
handles what you are asking for.
| Quote: | The OnCommandGet and OnCommandOther event are not
implemented (I wanted to use command handlers)
|
Why? That requires you to do full parsing manually for everything that
TIdHTTPServer already supports natively.
| Quote: | The problem is that this command handler is never created and executed.
|
Nor should it be. TIdHTTPServer does not support use of the command
handlers to begin with. You must use the OnCommandGet event instead. That
is how TIdHTTPServer is specifically designed to work.
| Quote: | Also none of the events of the http server:
|
Again, because command handlers are not supported in TIdHTTPServer at all,
thus those events are ignored.
| Quote: | After debuging the source code including steping through the
indy source code I have discovered that the overritten DoExecute
function implemented in the TIdCustomHTTPServer class does
not verify for command handlers as the DoExecute function of
the TIdTCPServer.
|
Correct. CommandHandlers are implemented at the TIdTCPServer level and
require TIdTCPServer.DoExecute(), but TIsHTTPServer overrrides DoExecute()
(for good reason), thus the CommandHandlers are ignored.
| Quote: | It seems that command handlers are ignored in the implementation of the
class TIdCustomHTTPServer (and hence it's specialization TIdHTTPServer
that
I am using).
|
Correct.
| Quote: | Can you guys confirm this for me in which case implementing
OnCommandGet would be the obvious solution.
|
For what you ask, there is no point in using TIdHTTPServer if you are not
going to use it the way it was designed (use the OnCommandGet event). You
may as well just use TIdTCPServer itself directly if you want to do custom
parsing of the client's data.
Gambit
|
|
| Back to top |
|
 |
Virgil Guest
|
Posted: Thu Feb 26, 2004 6:42 am Post subject: Re: HTTP server with command handlers - query |
|
|
Now that you mention it all seems perfectly clear.
From Indy's documentation I could not find this specified anywere so I
assumed (wrongly) that it is possible to both handlers for the specific HTTP
commands or implement the OnGetCommand event.
Thanks for that clearing up
|
|
| Back to top |
|
 |
|