Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2015-01

[PATCH] Add the CreateCGIParams/FreeCGIParams methods in FCL FCGI

5 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

silvioprog

Hello,

Please see this patch in attached. Can I send it to bugtracker?

Thank you!

Silvio Clécio My public projects - github.com/silvioprog
Michael Van Canneyt
to silvioprog
silvioprog wrote
Hello, Please see this patch in attached. Can I send it to bugtracker?

I don't see the point. Why do you need this ?

Michael.

silvioprog
to Michael Van Canneyt

On Thu, Jan 29, 2015 at 7:26 PM, Michael Van Canneyt <

Show quoted text 12 lines
wrote: On Thu, 29 Jan 2015, silvioprog wrote: Hello, > > Please see this patch in attached. Can I send it to bugtracker? > I don't see the point. Why do you need this ?

Yes, after a while I saw that my patch seems redundant. But please notice this code below:

function TFCGIRequest.ProcessFCGIRecord(AFCGIRecord: PFCGI_Header): boolean;
...
                        else
                          begin
                          if not assigned(FCGIParams) then
                            FCGIParams := TStringList.Create;
GetNameValuePairsFromContentRecord(PFCGI_ContentRecord(AFCGIRecord),FCGIParams);
                          end;

It seems to offer the programmer to create an own cgiparams. Is this "if" just to create this field when the request need to use it?

What do you think about to create the FCGIParams field in the create of the TFCGIRequest class and remove the "if" from the ProcessFCGIRecord method?

I think that the ProcessFCGIRecord method is more triggered than the constructor of the TFCGIRequest class.

Silvio Clécio My public projects - github.com/silvioprog
Michael Van Canneyt
to silvioprog
silvioprog wrote 25 lines
On Thu, Jan 29, 2015 at 7:26 PM, Michael Van Canneyt wrote: On Thu, 29 Jan 2015, silvioprog wrote: Hello, Please see this patch in attached. Can I send it to bugtracker? I don't see the point. Why do you need this ? Yes, after a while I saw that my patch seems redundant. But please notice this code below: function TFCGIRequest.ProcessFCGIRecord(AFCGIRecord: PFCGI_Header): boolean; ...                         else                           begin                           if not assigned(FCGIParams) then                             FCGIParams := TStringList.Create;                           GetNameValuePairsFromContentRecord(PFCGI_ContentRecord(AFCGIRecord),FCGIParams);                           end; It seems to offer the programmer to create an own cgiparams. Is this "if" just to create this field when the request need to use it?

Yes. I usually prefer late allocation on an as-needed basis.

Show quoted text 5 lines
What do you think about to create the FCGIParams field in the create of the TFCGIRequest class and remove the "if" from the ProcessFCGIRecord method? I think that the ProcessFCGIRecord method is more triggered than the constructor of the TFCGIRequest class.

ProcessFCGIRecord is usually called only once or maybe twice if there are really a lot of parameters. So I seriously doubt it will make a noticeable difference in speed :)

Michael.

silvioprog
to Michael Van Canneyt

On Fri, Jan 30, 2015 at 4:39 AM, Michael Van Canneyt <

Show quoted text 36 lines
wrote: On Thu, 29 Jan 2015, silvioprog wrote: > On Thu, Jan 29, 2015 at 7:26 PM, Michael Van Canneyt < > > wrote: > On Thu, 29 Jan 2015, silvioprog wrote: > > Hello, > > Please see this patch in attached. Can I send it to > bugtracker? > > > I don't see the point. Why do you need this ? > > > Yes, after a while I saw that my patch seems redundant. But please notice > this code below: > > function TFCGIRequest.ProcessFCGIRecord(AFCGIRecord: PFCGI_Header): > boolean; > ... > else > begin > if not assigned(FCGIParams) then > FCGIParams := TStringList.Create; > GetNameValuePairsFromContentRe > cord(PFCGI_ContentRecord(AFCGIRecord),FCGIParams); > end; > > It seems to offer the programmer to create an own cgiparams. Is this "if" > just to create this field when the request need to use it? > Yes. I usually prefer late allocation on an as-needed basis.

Me too. =)

Show quoted text 12 lines
What do you think about to create the FCGIParams field in the create of > the TFCGIRequest class and remove the "if" from the > ProcessFCGIRecord method? > > I think that the ProcessFCGIRecord method is more triggered than the > constructor of the TFCGIRequest class. > ProcessFCGIRecord is usually called only once or maybe twice if there are really a lot of parameters. So I seriously doubt it will make a noticeable difference in speed :)

Hehe indeed. Keep it as is. =)

Silvio Clécio My public projects - github.com/silvioprog