It is currently Tue Oct 24, 2017 1:37 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: [Done] WaitFastCGIRequest() not working on MacOS
PostPosted: Thu Oct 05, 2017 9:56 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Tue Jun 08, 2004 10:29 am
Posts: 122
Location: Zurich, Switzerland
PureBasic 5.61 (x64) on MacOS (Sierra / High Sierra)

It seems as the FastCGI is not working on MacOS. I have the following code (taken from the PureBasic Help):

Code:
If InitCGI()
   Debug "CGI initialized"
   If InitFastCGI(5600)
      Debug "FastCGI initialized"
      While WaitFastCGIRequest()
         Debug "FastCGI-Request received - IS NEVER REACHED"
         If ReadCGI()
            WriteCGIHeader(#PB_CGI_HeaderContentType, "text/html", #PB_CGI_LastHeader)
            WriteCGIString("<html><title>PureBasic - FastCGI</title><body>Hello from PureBasic FastCGI !</body></html>")
         EndIf
      Wend
      Debug "After FastCGI-Loop - should never be seen..."
   EndIf
EndIf
End

The debug output is:
Code:
CGI initialized
FastCGI initialized
After FastCGI-Loop - should never be seen...

The code is taken from the PB-Help and runs fine on Purebasic for Windows. On my OSX however, the "While WaitFastCGIRequest()"-Loop is never entered and does also not block (does not wait for an incoming request).

Thank you

_________________
As you walk on by, Will you call my name? Or will you walk away?


Last edited by wayne-c on Tue Oct 17, 2017 3:18 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: WaitFastCGIRequest() not working on MacOS
PostPosted: Tue Oct 17, 2017 10:43 am 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 13109
Location: France
Hi ! Could you tell me which configuration and which webserver did you used ?


Top
 Profile  
Reply with quote  
 Post subject: Re: WaitFastCGIRequest() not working on MacOS
PostPosted: Tue Oct 17, 2017 10:50 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Tue Jun 08, 2004 10:29 am
Posts: 122
Location: Zurich, Switzerland
Hello Fred

Thank you for looking at this.

Quote:
Hi ! Could you tell me which configuration and which webserver did you used ?

I am using CaddyServer (https://caddyserver.com/download) on both Platforms (Win/MacOSX) with the minimal configuration that runs almost out of the box ("fastcgi / 127.0.0.1:5600", see https://caddyserver.com/docs/fastcgi). I also tested with Nginx.

However as far as I understand the FastCGI-App should start and run independently from the presence of a Webserver; when I run the PB example above, the App does not even wait for incoming requests coming from the web server...

On Windows this works as expected, that means I can run the PB app, it will block (wait for incoming request in WaitFastCGIRequest()), then (or before, it does not matter) start the web server and make a fastcgi request which is then handled by the PB app.

_________________
As you walk on by, Will you call my name? Or will you walk away?


Top
 Profile  
Reply with quote  
 Post subject: Re: WaitFastCGIRequest() not working on MacOS
PostPosted: Tue Oct 17, 2017 2:37 pm 
Offline
Administrator
Administrator

Joined: Fri May 17, 2002 4:39 pm
Posts: 13109
Location: France
Yes you are right, it should block even without webserver. I think I found the issue, could you try this new lib ? (osx x64, rename the old one and paste this one isntead in PureBasic/purelibraries/macos):

http://www.purebasic.com/beta/macosx_x64/libpbfcgi.a


Top
 Profile  
Reply with quote  
 Post subject: Re: WaitFastCGIRequest() not working on MacOS
PostPosted: Tue Oct 17, 2017 3:17 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Tue Jun 08, 2004 10:29 am
Posts: 122
Location: Zurich, Switzerland
It seems to work now as expected, thank you!

_________________
As you walk on by, Will you call my name? Or will you walk away?


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye