예제 #1
0
void Transport::getArrayParam(const char *name,
                              std::vector<std::string> &values,
                              Method method /* = GET */) {
  if (method == Method::GET || method == Method::AUTO) {
    if (m_url == nullptr) {
      parseGetParams();
    }
    ParamMap::const_iterator iter = m_getParams.find(name);
    if (iter != m_getParams.end()) {
      const vector<const char *> &params = iter->second;
      values.insert(values.end(), params.begin(), params.end());
    }
  }

  if (method == Method::POST || method == Method::AUTO) {
    if (!m_postDataParsed) {
      parsePostParams();
    }
    ParamMap::const_iterator iter = m_postParams.find(name);
    if (iter != m_postParams.end()) {
      const vector<const char *> &params = iter->second;
      values.insert(values.end(), params.begin(), params.end());
    }
  }
}
예제 #2
0
void Transport::getArrayParam(const char *name,
                              std::vector<std::string> &values,
                              Method method /* = GET */) {
  FiberReadLock lock(this);

  if (method == GET || method == AUTO) {
    if (m_url == NULL) {
      FiberReadLockViolator unlock(this);
      parseGetParams();
    }
    ParamMap::const_iterator iter = m_getParams.find(name);
    if (iter != m_getParams.end()) {
      const vector<const char *> &params = iter->second;
      values.insert(values.end(), params.begin(), params.end());
    }
  }

  if (method == POST || method == AUTO) {
    if (!m_postDataParsed) {
      FiberReadLockViolator unlock(this);
      parsePostParams();
    }
    ParamMap::const_iterator iter = m_postParams.find(name);
    if (iter != m_postParams.end()) {
      const vector<const char *> &params = iter->second;
      values.insert(values.end(), params.begin(), params.end());
    }
  }
}
예제 #3
0
std::string Transport::getParam(const char *name,
                                Method method /* = Method::GET */) {
  assert(name && *name);

  if (method == Method::GET || method == Method::AUTO) {
    if (m_url == nullptr) {
      parseGetParams();
    }
    ParamMap::const_iterator iter = m_getParams.find(name);
    if (iter != m_getParams.end()) {
      return iter->second[0];
    }
  }

  if (method == Method::POST || method == Method::AUTO) {
    if (!m_postDataParsed) {
      parsePostParams();
    }
    ParamMap::const_iterator iter = m_postParams.find(name);
    if (iter != m_postParams.end()) {
      return iter->second[0];
    }
  }

  return "";
}
예제 #4
0
std::string Transport::getParam(const char *name,  Method method /* = GET */) {
  ASSERT(name && *name);
  FiberReadLock lock(this);

  if (method == GET || method == AUTO) {
    if (m_url == NULL) {
      FiberReadLockViolator unlock(this);
      parseGetParams();
    }
    ParamMap::const_iterator iter = m_getParams.find(name);
    if (iter != m_getParams.end()) {
      return iter->second[0];
    }
  }

  if (method == POST || method == AUTO) {
    if (!m_postDataParsed) {
      FiberReadLockViolator unlock(this);
      parsePostParams();
    }
    ParamMap::const_iterator iter = m_postParams.find(name);
    if (iter != m_postParams.end()) {
      return iter->second[0];
    }
  }

  return "";
}
예제 #5
0
bool Transport::paramExists(const char *name, Method method /* = GET */) {
  ASSERT(name && *name);
  FiberReadLock lock(this);

  if (method == GET || method == AUTO) {
    if (m_url == NULL) {
      FiberReadLockViolator unlock(this);
      parseGetParams();
    }
    if (m_getParams.find(name) != m_getParams.end()) {
      return true;
    }
  }

  if (method == POST || method == AUTO) {
    if (!m_postDataParsed) {
      FiberReadLockViolator unlock(this);
      parsePostParams();
    }
    if (m_postParams.find(name) != m_postParams.end()) {
      return true;
    }
  }

  return false;
}
예제 #6
0
bool HttpRequest::parseContent()
{
	if(MethodBase::parseContent() == false)
		return false;

	parseUrlParams();
	parsePostParams();

	return true;
}
예제 #7
0
bool Transport::paramExists(const char *name,
                            Method method /* = Method::GET */) {
  assert(name && *name);
  if (method == Method::GET || method == Method::AUTO) {
    if (m_url == nullptr) {
      parseGetParams();
    }
    if (m_getParams.find(name) != m_getParams.end()) {
      return true;
    }
  }

  if (method == Method::POST || method == Method::AUTO) {
    if (!m_postDataParsed) {
      parsePostParams();
    }
    if (m_postParams.find(name) != m_postParams.end()) {
      return true;
    }
  }

  return false;
}
예제 #8
0
void HttpRequest::parsePostParams()
{
    parsePostParams(m_content->toString(), m_contentType, m_contentBoundary);
}