summaryrefslogtreecommitdiff
path: root/src/rgw/rgw_fcgi.cc
blob: 0504505aad083af7f42a1500e739266fe19dfeb9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50


#include "rgw_fcgi.h"

#include "acconfig.h"
#ifdef FASTCGI_INCLUDE_DIR
# include "fastcgi/fcgiapp.h"
#else
# include "fcgiapp.h"
#endif


int RGWFCGX::write_data(const char *buf, int len)
{
  return FCGX_PutStr(buf, len, fcgx->out);
}

int RGWFCGX::read_data(char *buf, int len)
{
  return FCGX_GetStr(buf, len, fcgx->in);
}

void RGWFCGX::flush()
{
  FCGX_FFlush(fcgx->out);
}

void RGWFCGX::init_env(CephContext *cct)
{
  env.init(cct, (char **)fcgx->envp);
}

int RGWFCGX::send_status(const char *status, const char *status_name)
{
  return print("Status: %s\n", status);
}

int RGWFCGX::send_100_continue()
{
  int r = send_status("100", "Continue");
  if (r >= 0) {
    flush();
  }
  return r;
}

int RGWFCGX::complete_header()
{
  return print("\r\n");
}