Esempio n. 1
0
void HttpHeaders::set100ContinueExpected(HttpMessage& message, bool set) {
    if (set) {
        message.setHeader(Names::EXPECT, Values::CONTINUE);
    }
    else {
        message.removeHeader(Names::EXPECT);
    }
}
Esempio n. 2
0
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);
        }
    }
}
Esempio n. 3
0
void HttpHeaders::setHost(HttpMessage& message, const std::string& value) {
    message.setHeader(Names::HOST, value);
}
Esempio n. 4
0
void HttpHeaders::setContentLength(HttpMessage& message, int length) {
    message.setHeader(Names::CONTENT_LENGTH, length);
}
Esempio n. 5
0
void HttpHeaders::setIntHeader(HttpMessage& message, const std::string& name, int value) {
    message.setHeader(name, Integer::toString(value));
}
Esempio n. 6
0
void HttpHeaders::setHeader(HttpMessage& message, const std::string& name, const std::vector<std::string>& values) {
    message.setHeader(name, values);
}
Esempio n. 7
0
void HttpHeaders::setHeader(HttpMessage& message, const std::string& name, const std::string& value) {
    message.setHeader(name, value);
}