#1 2023-03-19 01:56:57

redhan_xp
Member
Registered: 2023-03-18
Posts: 13

THttpServerRequest create?

Hello Ab,


I want to implement THttpServerRequest inheritance,

For example: TWebSocketAsyncServer.ProcessClass

Offline

#2 2023-03-19 16:46:25

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: THttpServerRequest create?

Why?
I am almost certain it is not something which is worth doing, without making some confusion, in respect to the Single Responsibility SOLID principle.

Anyway, you can already inherit TWebSocketProcessServer and override the ComputeContext() then change it into TWebSocketAsyncServer.ProcessClass property, as you proposed.

Offline

#3 2023-03-20 03:15:59

redhan_xp
Member
Registered: 2023-03-18
Posts: 13

Re: THttpServerRequest create?

Thank you. I didn't find the ComputeContext method before.

Offline

#4 2023-03-20 03:31:57

redhan_xp
Member
Registered: 2023-03-18
Posts: 13

Re: THttpServerRequest create?

THttpServerRequest.create ?


mormot.net.async.pas:   (row 3366)
3364             HTTP_UPG_FLAGS[hfConnectionUpgrade in fHttp.HeaderFlags];
3365    if fRequest = nil then // created once, if not rejected by OnBeforeBody
3366:     fRequest := THttpServerRequest.Create(
3367        fServer, fConnectionID, fReadThread, flags, @fConnectionOpaque)
3368    else


mormot.net.server.pas:   (3082;  4088)
3081    // compute the response
3082:   req := THttpServerRequest.Create(self, ConnectionID, ConnectionThread,
3083      HTTP_TLS_FLAGS[ClientSock.TLS.Enabled] +
3084      HTTP_UPG_FLAGS[hfConnectionUpgrade in ClientSock.Http.HeaderFlags],
....
4086      if global_verbs[hvOPTIONS] = '' then
4087        global_verbs := VERB_TEXT;
4088:     ctxt := THttpServerRequest.Create(self, 0, self, [], nil);
4089      // main loop reusing a single ctxt instance for this thread
4090      reqid := 0;

Last edited by redhan_xp (2023-03-20 06:19:48)

Offline

#5 2023-03-20 07:24:20

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: THttpServerRequest create?

But why do you want to use an inherited class?

Offline

#6 2023-03-20 10:15:33

redhan_xp
Member
Registered: 2023-03-18
Posts: 13

Re: THttpServerRequest create?

I need to implement the interface and try it out for the dll. Let me handle it in a different way, thank you

Offline

#7 2023-03-20 11:03:33

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: THttpServerRequest create?

I don't understand, sorry.
I won't implement something which I won't find any actual purpose.

Offline

Board footer

Powered by FluxBB