Пример #1
0
void ResourceRequest::updateSoupMessageMembers(SoupMessage* soupMessage) const
{
    updateSoupMessageHeaders(soupMessage->request_headers);

    String firstPartyString = firstPartyForCookies().string();
    if (!firstPartyString.isEmpty()) {
        GOwnPtr<SoupURI> firstParty(soup_uri_new(firstPartyString.utf8().data()));
        soup_message_set_first_party(soupMessage, firstParty.get());
    }

    soup_message_set_flags(soupMessage, m_soupFlags);

    if (!acceptEncoding())
        soup_message_disable_feature(soupMessage, SOUP_TYPE_CONTENT_DECODER);
}
Пример #2
0
bool Transport::decideCompression() {
  assert(m_compressionDecision == CompressionDecision::NotDecidedYet);

  if (!RuntimeOption::ForceCompressionURL.empty() &&
      getCommand() == RuntimeOption::ForceCompressionURL) {
    m_compressionDecision = CompressionDecision::HasTo;
    return true;
  }

  if (acceptEncoding("gzip") ||
      (!RuntimeOption::ForceCompressionCookie.empty() &&
       cookieExists(RuntimeOption::ForceCompressionCookie.c_str())) ||
      (!RuntimeOption::ForceCompressionParam.empty() &&
       paramExists(RuntimeOption::ForceCompressionParam.c_str()))) {
    m_compressionDecision = CompressionDecision::Should;
    return true;
  }

  m_compressionDecision = CompressionDecision::ShouldNot;
  return false;
}