Recent

Author Topic: Apache module compiling with 0.9.26  (Read 19185 times)

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Apache module compiling with 0.9.26
« Reply #15 on: February 18, 2009, 04:53:06 am »
Quote
I think I should download using SVN so that I can keep things up to date. Is there any tutorial on this?
http://wiki.lazarus.freepascal.org/Installing_Lazarus

sandeep_c24

  • Full Member
  • ***
  • Posts: 114
Re: Apache module compiling with 0.9.26
« Reply #16 on: February 18, 2009, 08:36:11 am »
I have successfully downloaded fpc source using svn but I cannot follow what to do from section Installing Free Pascal under Linux/BSD manually.

Could someone please give more info.

I am trying to install fpc and lazarus using svn snapshots as I need to write apache modules.

Sandeep

sandeep_c24

  • Full Member
  • ***
  • Posts: 114
Re: Apache module compiling with 0.9.26
« Reply #17 on: February 19, 2009, 10:46:37 am »
I am using FPC and Lazarus from svn and I am still getting following error in apache's error log.

This is the log in apache error log
Heap dump by heaptrc unit
20 memory blocks allocated : 1282/1320
20 memory blocks freed     : 1282/1320
0 unfreed memory blocks : 0
True heap size : 360448
True free heap : 360448

Is anyone using Apache module successfully?

Sandeep

sandeep_c24

  • Full Member
  • ***
  • Posts: 114
Re: Apache module compiling with 0.9.26
« Reply #18 on: February 19, 2009, 11:04:53 am »
I made a new Apache module application using Lazarus and it is working now. Before I was trying to compile mod_hello app.

The next problem I have is the ARequest parameter does not have any query field values. Is this a know bug?

Sandeep

bobo

  • Full Member
  • ***
  • Posts: 171
Re: Apache module compiling with 0.9.26
« Reply #19 on: February 19, 2009, 08:15:11 pm »
Nope, it should work.

ARequest.QueryFields stringlist should contain all the query parameters.

CGI applications had problems until a few months ago with the ARequest.Contentfields but that was fixed last September so if you have the latest SVN compiled FPC and Lazarus, it should work.

How do you pass the query parameters to the apache module (what is the URL you call the apache module with)?

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Apache module compiling with 0.9.26
« Reply #20 on: February 20, 2009, 05:21:47 am »
Quote
I am using FPC and Lazarus from svn and I am still getting following error in apache's error log.
It's not an error, but rather than a report regarding memory usage of the application. It's activated by -gh switch or if used units have HeapTrc in their uses clause. The report shows that no memory leak occurs.

sandeep_c24

  • Full Member
  • ***
  • Posts: 114
Re: Apache module compiling with 0.9.26
« Reply #21 on: February 20, 2009, 10:36:32 am »
Hi bobo

the url I use is

http://localhost/sc/index?page=1

and the code I have is

  AResponse.Content := 'Query parameters are '
    + ARequest.QueryFields.Text + ' - '
    + ARequest.QueryFields.Values['page'];

The only thing I see in web page is 'Query parameters are '.

Sandeep

sandeep_c24

  • Full Member
  • ***
  • Posts: 114
Re: Apache module compiling with 0.9.26
« Reply #22 on: February 20, 2009, 11:00:09 pm »
I have had a look at the source and I think the reason no query string is returned is because in following procedure

Code: [Select]
procedure TApacheRequest.InitFromRequest;

Var
  I : Integer;
  S : String;
 
begin
  // This fills the internal table. We should try
  // to get rid of it.
  For I:=0 to NoHTTPFields do
    begin
    S:=GetFieldValue(i);
    If (S<>'') then
      SetFieldValue(I,S);
    end;
end;

the value of constant NoHTTPFields is 24 and in function

Code: [Select]
function TApacheRequest.GetFieldValue(Index: Integer): String;

request argument is returned for index of 33

Code: [Select]
      33 : Result:=StrPas(FRequest^.args); // Query

Sandeep

bobo

  • Full Member
  • ***
  • Posts: 171
Re: Apache module compiling with 0.9.26
« Reply #23 on: February 21, 2009, 03:22:42 am »
Need to check this out. Might be some bug there now.
« Last Edit: February 22, 2009, 02:27:41 am by bobo »

bobo

  • Full Member
  • ***
  • Posts: 171
Re: Apache module compiling with 0.9.26
« Reply #24 on: February 22, 2009, 02:27:52 am »
OK, it seems that this was not developed for apache modules yet. And it is not as simple as to just run that loop until higher numbers, the code is not there for that in the GetFieldValue, SetFieldValue.

So best if everyone keeps with the CGI applications for now until it is added.

bobo

  • Full Member
  • ***
  • Posts: 171
Re: Apache module compiling with 0.9.26
« Reply #25 on: February 22, 2009, 02:47:49 pm »
Here are some updates attached that should work now for the apache modules.
Just overwrite these files in your FPC /packages/fcl-web/src/ folder and recompile both FPC and Lazarus.

Or it should work by copying them next to your project files theoretically.

Changes:
1. Added: CGI and Apache applications' temporary uploaded files will be deleted after a request is handled /html forms with file upload(s)/

2. Fixed: Temporary files are not created with a single CRLF in them for html forms where no file was uploaded.

3. Added: Apache applications are now processing and passing the input parameters GET/PUT (QueryFields, ContentFields, uploaded files, etc.). This was only there for CGI applications.

4. THTTPHeader and descendants RemoteAddress property renamed to RemoteAddr for Delphi compatibility

5. Note: For some unknown reason the

ap_get_remote_host(FRequest^.Connection, FRequest^.Per_Dir_Config, REMOTE_HOST, Nil)

is always crashing for me, therefore this field is not populated at the moment (commented out).
This would force a DNS lookup according to the HostnameLookups setting in the Apache configuration.

I think that's it. If it works I'll submit these changes into the bug tracking system so it can be further rewieved and integrated into the SVN.
« Last Edit: February 22, 2009, 02:53:09 pm by bobo »

sandeep_c24

  • Full Member
  • ***
  • Posts: 114
Re: Apache module compiling with 0.9.26
« Reply #26 on: February 25, 2009, 05:51:08 am »
Hi bobo

I tried compiling by putting the file in the folder where my App is but that did not work. I then recompiled FPC and Lazarus but now I am getting

Quote
Recompiling fpapache, checksum changed for httpd

What should I do next?

Sandeep

bobo

  • Full Member
  • ***
  • Posts: 171
Re: Apache module compiling with 0.9.26
« Reply #27 on: February 25, 2009, 07:40:54 am »
Seems some compilation config problem. Try copying all files from the FPC /packages/fcl-web/src/ directory into your project directory then and replace the files I've attached.

sandeep_c24

  • Full Member
  • ***
  • Posts: 114
Re: Apache module compiling with 0.9.26
« Reply #28 on: February 25, 2009, 08:39:53 am »
It was because I had httpd13 and httpd20 in the fpc folders. It works fine after I removed them.

Thanks bobo for fixing this issue. It seems to work for now, but I'll write a app using it and if there are any problems I'll report them here.

Sandeep

 

TinyPortal © 2005-2018