FinishFastCGIRequest()

Syntax

FinishFastCGIRequest()
Description
Finish the current FastCGI request and free all resources associated to it. It's not mandatory to use this command, as the request will be automatically finished when WaitFastCGIRequest()() is called again, or when the thread ends. It can still be useful in some special case where resources are light before doing other processing.

Parameters

None.

Return value

Returns non-zero if a new request has been processed.

Example

  If Not InitCGI()
    End
  EndIf
  
  If Not InitFastCGI(5600) ; Create the FastCGI program on port 5600
    End
  EndIf
  
  While WaitFastCGIRequest()
  
    If ReadCGI()
      WriteCGIHeader(#PB_CGI_HeaderContentType, "text/html", #PB_CGI_LastHeader) ; Write the headers to inform the browser of the content format
  
      WriteCGIString("<html><title>PureBasic - FastCGI</title><body>" +
                     "Hello from PureBasic FastCGI !<br>" +
                     "Actual time: <b>"+FormatDate("%hh:%ii", Date()) + "</b>" +
                     "</body></html>")
                     
      FinishFastCGIRequest()
      
      ; Do some processing
      ;
      Delay(1000) ; Simulate large processing
      
    EndIf
  Wend

See Also

InitCGI(), InitFastCGI(), WaitFastCGIRequest()

Supported OS

All

<- CountCGIParameters() - CGI Index - InitCGI() ->