void HttpHeaders::set100ContinueExpected(HttpMessage& message, bool set) { if (set) { message.setHeader(Names::EXPECT, Values::CONTINUE); } else { message.removeHeader(Names::EXPECT); } }
void HttpHeaders::setKeepAlive(HttpMessage& message, bool keepAlive) { if (message.getProtocolVersion().isKeepAliveDefault()) { if (keepAlive) { message.removeHeader(Names::CONNECTION); } else { message.setHeader(Names::CONNECTION, Values::CLOSE); } } else { if (keepAlive) { message.setHeader(Names::CONNECTION, Values::KEEP_ALIVE); } else { message.removeHeader(Names::CONNECTION); } } }
void HttpHeaders::setHost(HttpMessage& message, const std::string& value) { message.setHeader(Names::HOST, value); }
void HttpHeaders::setContentLength(HttpMessage& message, int length) { message.setHeader(Names::CONTENT_LENGTH, length); }
void HttpHeaders::setIntHeader(HttpMessage& message, const std::string& name, int value) { message.setHeader(name, Integer::toString(value)); }
void HttpHeaders::setHeader(HttpMessage& message, const std::string& name, const std::vector<std::string>& values) { message.setHeader(name, values); }
void HttpHeaders::setHeader(HttpMessage& message, const std::string& name, const std::string& value) { message.setHeader(name, value); }