static int
ts_lua_client_response_set_version(lua_State *L)
{
  const char *version;
  size_t len;
  int major, minor;

  ts_lua_http_ctx *http_ctx;

  GET_HTTP_CONTEXT(http_ctx, L);

  TS_LUA_CHECK_CLIENT_RESPONSE_HDR(http_ctx);

  version = luaL_checklstring(L, 1, &len);

  sscanf(version, "%2u.%2u", &major, &minor);

  TSHttpHdrVersionSet(http_ctx->client_response_bufp, http_ctx->client_response_hdrp, TS_HTTP_VERSION(major, minor));

  return 0;
}
Esempio n. 2
0
static int
ts_lua_server_response_set_version(lua_State * L)
{
  const char *version;
  size_t len;
  int major, minor;

  ts_lua_http_ctx *http_ctx;

  http_ctx = ts_lua_get_http_ctx(L);

  TS_LUA_CHECK_SERVER_RESPONSE_HDR(http_ctx);

  version = luaL_checklstring(L, 1, &len);

  sscanf(version, "%2u.%2u", &major, &minor);

  TSHttpHdrVersionSet(http_ctx->server_response_bufp, http_ctx->server_response_hdrp, TS_HTTP_VERSION(major, minor));

  return 0;
}
Esempio n. 3
0
static int
ts_lua_client_request_set_version(lua_State *L)
{
    const char  *version;
    size_t      len;
    int         major, minor;

    ts_lua_http_ctx  *http_ctx;

    http_ctx = ts_lua_get_http_ctx(L);

    version = luaL_checklstring(L, 1, &len);

    sscanf(version, "%2u.%2u", &major, &minor);

    TSHttpHdrVersionSet(http_ctx->client_request_bufp, http_ctx->client_request_hdrp, TS_HTTP_VERSION(major, minor));

    return 0;
}