示例#1
0
inline void parser::set_body(std::string const & value) {
    if (value.size() == 0) {
        remove_header("Content-Length");
        m_body = "";
        return;
    }

    std::stringstream len;
    len << value.size();
    replace_header("Content-Length", len.str());
    m_body = value;
}
示例#2
0
static int
replace_header_plugin(TSCont contp ATS_UNUSED, TSEvent event, void *edata)
{
    TSHttpTxn txnp = (TSHttpTxn) edata;

    switch (event) {
    case TS_EVENT_HTTP_READ_RESPONSE_HDR:
        replace_header(txnp);
        return 0;
    default:
        break;
    }
    return 0;
}
示例#3
0
static int
replace_header_plugin(INKCont contp, INKEvent event, void *edata)
{
  INKHttpTxn txnp = (INKHttpTxn) edata;

  switch (event) {
  case INK_EVENT_HTTP_READ_RESPONSE_HDR:
    replace_header(txnp, contp);
    return 0;
  default:
    break;
  }
  return 0;
}
示例#4
0
文件: parser.hpp 项目: dbarobin/steem
inline void parser::set_body(std::string const & value) {
    if (value.size() == 0) {
        remove_header("Content-Length");
        m_body.clear();
        return;
    }

    // TODO: should this method respect the max size? If so how should errors
    // be indicated?

    std::stringstream len;
    len << value.size();
    replace_header("Content-Length", len.str());
    m_body = value;
}