예제 #1
0
/*
 *	send response to server
 */
static void sendResponse(HTTPResponse *resp)
{
   String *resphdrs;
#ifndef PROFILE
   FCGX_FPrintF(out,"Status: %d %s" CRLF,resp->status,resp->statusMsg);
#endif

   resphdrs = resp_packageHeaders(resp);
#ifndef PROFILE
   FCGX_PutS(resphdrs->text,out);
#endif
   str_free(resphdrs);
#ifndef PROFILE
   FCGX_PutS(CRLF, out);
#endif

#ifndef PROFILE

   /* resp->content_valid will be 0 for HEAD requests and empty responses */
   if (resp->content_valid) {
      while (resp->content_read < resp->content_length) {
         //fwrite(resp->content,sizeof(char),resp->content_valid,stdout);
	      FCGX_PutStr(resp->content, resp->content_valid, out);
		 if (resp_getResponseContent(resp, 1) == -1)
         {
         	break;
         }
      }
      //fwrite(resp->content,sizeof(char),resp->content_valid,stdout);
      FCGX_PutStr(resp->content, resp->content_valid, out);
   }
   FCGX_FFlush(out);
#endif
   return;		
}
예제 #2
0
int FCGI_fflush(FCGI_FILE *fp)
{
    if(fp->stdio_stream)
        return fflush(fp->stdio_stream);
    else if(fp->fcgx_stream)
        return FCGX_FFlush(fp->fcgx_stream);
    return EOF;
}
예제 #3
0
파일: fcgi.c 프로젝트: luongtran/po_tracker
static VALUE fcgi_stream_flush(VALUE self)
{
  FCGX_Stream *stream;

  Data_Get_Struct(self, FCGX_Stream, stream);
  if (FCGX_FFlush(stream) == EOF)
    CHECK_STREAM_ERROR(stream);
  return Qnil;
}
예제 #4
0
파일: CgiService.cpp 프로젝트: alex43dm/ad
void CgiService::Response(FCGX_Request *req,
                          const std::string &out,
                          const std::string &cookie,
                          const std::string &cookie_track)
{
    FCGX_FPrintF(req->out,"Content-type: text/html\r\n");
    FCGX_FPrintF(req->out,"Set-Cookie: %s\r\n", cookie.c_str());
    FCGX_FPrintF(req->out,"Set-Cookie: %s\r\n", cookie_track.c_str());
    FCGX_FPrintF(req->out,"Status: 200 OK\r\n");
    FCGX_FFlush(req->out);
    FCGX_FPrintF(req->out,"\r\n%s\n", out.c_str());
    FCGX_Finish_r(req);
}
예제 #5
0
static PyObject *
fcgi_Stream_flush(fcgi_Stream *self)
{
    int rc;
    FCGX_Stream *s;

    fcgi_Stream_Check();

    s = *(self->s);

    Py_BEGIN_ALLOW_THREADS
    rc = FCGX_FFlush(s);
    Py_END_ALLOW_THREADS

    if (rc == -1) {
        PyErr_SetString(PyExc_IOError, "Flush failed");
        return NULL;
    }

    Py_RETURN_NONE;
}
예제 #6
0
파일: CgiService.cpp 프로젝트: alex43dm/ad
void CgiService::Response(FCGX_Request *req, int status)
{
    FCGX_FPrintF(req->out,"Content-type: text/html\r\n");

    FCGX_FPrintF(req->out,"Status: ");
    switch (status)
    {
    case 200:
        FCGX_FPrintF(req->out,"200 OK");
        break;
    case 301:
        FCGX_FPrintF(req->out,"301 Moved Permanently");
        break;
    case 302:
        FCGX_FPrintF(req->out,"302 Found");
        break;
    case 307:
        FCGX_FPrintF(req->out,"307 Temporary Redirect");
        break;
    case 400:
        FCGX_FPrintF(req->out,"400 Bad Request");
        break;
    case 403:
        FCGX_FPrintF(req->out,"403 Forbidden");
        break;
    case 500:
        FCGX_FPrintF(req->out,"500 Internal Server Error");
        break;
    case 503:
        FCGX_FPrintF(req->out,"503 Service Unavailable");
        break;
    default:
        FCGX_FPrintF(req->out,"200 OK");
        break;
    }
    FCGX_FPrintF(req->out,"\r\n");
    FCGX_FFlush(req->out);
    FCGX_Finish_r(req);
}
예제 #7
0
void FastCgiDevice::flush()
{
	// Warning!! Not recommended by FCGI documentation
	FCGX_FFlush( m_stream );
}
예제 #8
0
static void io_fcgi_flush(void *context)
{
	FCGX_Request *request = (FCGX_Request *)context;
	FCGX_FFlush(request->out);
}