View Issue Details

IDProjectCategoryView StatusLast Update
0033012FPCPackagespublic2018-01-13 13:30
ReporterSven BarthAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformi386OSWin32OS VersionNT 6.1 (7)
Product Version3.1.1Product Build 
Target Version3.2.0Fixed in Version3.1.1 
Summary0033012: fcl-web: calling a web module on a fphttp based application twice leads to exception
DescriptionWhen a web module is called twice on a fphttp based applications leads to the following exception:

Duplicate name: A component named "<ModuleName>" already exists
Steps To ReproduceCompile the example in $fpcdir/packages/fcl-web/examples/echo/fphttp and run the binary. Open the corresponding URL (e.g. localhost:8080/TEchoModule) in a browser and load it a second time.

Expected result: the same page is shown again

Actual result: an exception page is shown
Additional InformationA patch is attached which checks for an existing instance like the legacy routing code does before creating a new one.
TagsNo tags attached.
Fixed in Revision37952
FPCOldBugId0
FPCTarget
Attached Files
  • custweb.patch (615 bytes)
    Index: custweb.pp
    ===================================================================
    --- custweb.pp	(Revision 37946)
    +++ custweb.pp	(Arbeitskopie)
    @@ -344,10 +344,12 @@
       MN:=Sender.ModuleName;
       // Modules expect the path info to contain the action name as the first part. (See getmodulename);
       ARequest.GetNextPathInfo;
    -  if Sender.SkipStreaming then
    -    M:=MC.CreateNew(Self)
    -  else
    -    M:=MC.Create(Self);
    +  M:=FindModule(MC);
    +  if (M=Nil) then
    +    if Sender.SkipStreaming then
    +      M:=MC.CreateNew(Self)
    +    else
    +      M:=MC.Create(Self);
       DoCallModule(M,MN,ARequest,AResponse);
     end;
     
    
    custweb.patch (615 bytes)

Activities

Sven Barth

2018-01-12 17:50

manager  

custweb.patch (615 bytes)
Index: custweb.pp
===================================================================
--- custweb.pp	(Revision 37946)
+++ custweb.pp	(Arbeitskopie)
@@ -344,10 +344,12 @@
   MN:=Sender.ModuleName;
   // Modules expect the path info to contain the action name as the first part. (See getmodulename);
   ARequest.GetNextPathInfo;
-  if Sender.SkipStreaming then
-    M:=MC.CreateNew(Self)
-  else
-    M:=MC.Create(Self);
+  M:=FindModule(MC);
+  if (M=Nil) then
+    if Sender.SkipStreaming then
+      M:=MC.CreateNew(Self)
+    else
+      M:=MC.Create(Self);
   DoCallModule(M,MN,ARequest,AResponse);
 end;
 
custweb.patch (615 bytes)

Michael Van Canneyt

2018-01-13 11:01

administrator   ~0105731

Checked and applied the patch. Thanks very much!

Sven Barth

2018-01-13 13:30

manager   ~0105740

Good to see that my intuition was correct. Thank you for applying :)

Issue History

Date Modified Username Field Change
2018-01-12 17:50 Sven Barth New Issue
2018-01-12 17:50 Sven Barth File Added: custweb.patch
2018-01-12 17:57 Michael Van Canneyt Assigned To => Michael Van Canneyt
2018-01-12 17:57 Michael Van Canneyt Status new => assigned
2018-01-13 11:01 Michael Van Canneyt Fixed in Revision => 37952
2018-01-13 11:01 Michael Van Canneyt Note Added: 0105731
2018-01-13 11:01 Michael Van Canneyt Status assigned => resolved
2018-01-13 11:01 Michael Van Canneyt Fixed in Version => 3.1.1
2018-01-13 11:01 Michael Van Canneyt Resolution open => fixed
2018-01-13 11:01 Michael Van Canneyt Target Version => 3.2.0
2018-01-13 13:30 Sven Barth Note Added: 0105740
2018-01-13 13:30 Sven Barth Status resolved => closed