fail_on_validation_err(0), stale_if_hit(0), accelerated(0),
ignore_cc(0), intercepted(0), hostVerified(0), spoof_client_ip(0),
internal(0), internalclient(0), must_keepalive(0), pinned(0),
- canRePin(0), chunked_reply(0), stream_error(0), sslPeek_(false),
+ canRePin(0), no_direct(false), chunked_reply(false),
+ stream_error(false), sslPeek_(false),
done_follow_x_forwarded_for(!FOLLOW_X_FORWARDED_FOR),
sslBumped_(false), destinationIPLookedUp_(false), resetTCP_(false),
- isRanged_(false) {
+ isRanged_(false)
+ {
#if USE_HTTP_VIOLATIONS
nocache_hack = 0;
#endif
unsigned int pinned :1; /* Request sent on a pinned connection */
unsigned int canRePin :1; ///< OK to reopen a failed pinned connection
unsigned int auth_sent :1; /* Authentication forwarded */
- unsigned int no_direct :1; /* Deny direct forwarding unless overriden by always_direct. Used in accelerator mode */
- unsigned int chunked_reply :1; /**< Reply with chunked transfer encoding */
- unsigned int stream_error :1; /**< Whether stream error has occured */
-
-#if FOLLOW_X_FORWARDED_FOR
- /* TODO: move from conditional definition to conditional setting */
-#endif /* FOLLOW_X_FORWARDED_FOR */
// When adding new flags, please update cloneAdaptationImmune() as needed.
bool resetTCP() const;
bool sslPeek() const { return sslPeek_; }
void setSslPeek() { sslPeek_=true; }
void clearSslPeek() { sslPeek_=false; }
-private:
+ bool hadStreamError() const { return stream_error; }
+ void setStreamError() { stream_error = true; }
+ void clearStreamError() { stream_error = false; }
+
+ bool isReplyChunked() const { return chunked_reply; }
+ void markReplyChunked() { chunked_reply = true; }
+
+ void setNoDirect() { no_direct=true; }
+ bool noDirect() { return no_direct; }
+
+private:
+ /** Deny direct forwarding unless overriden by always_direct.
+ * Used in accelerator mode */
+ bool no_direct :1;
+ bool chunked_reply :1; /**< Reply with chunked transfer encoding */
+ bool stream_error :1; /**< Whether stream error has occured */
bool sslPeek_ :1; ///< internal ssl-bump request to get server cert
/* done_follow_x_forwarded_for is set by default to the opposite of
* compilation option FOLLOW_X_FORWARDED_FOR (so that it returns
{
assert(rep == NULL);
- if (!multipartRangeRequest() && !http->request->flags.chunked_reply) {
+ if (!multipartRangeRequest() && !http->request->flags.isReplyChunked()) {
size_t length = lengthToSend(bodyData.range());
noteSentBodyBytes (length);
AsyncCall::Pointer call = commCbCall(33, 5, "clientWriteBodyComplete",
if (bodyData.data && bodyData.length) {
if (multipartRangeRequest())
packRange(bodyData, mb);
- else if (http->request->flags.chunked_reply) {
+ else if (http->request->flags.isReplyChunked()) {
packChunk(bodyData, *mb);
} else {
size_t length = lengthToSend(bodyData.range());
// After sending Transfer-Encoding: chunked (at least), always send
// the last-chunk if there was no error, ignoring responseFinishedOrFailed.
- const bool mustSendLastChunk = http->request->flags.chunked_reply &&
- !http->request->flags.stream_error && !context->startOfOutput();
+ const bool mustSendLastChunk = http->request->flags.isReplyChunked() &&
+ !http->request->flags.hadStreamError() &&
+ !context->startOfOutput();
if (responseFinishedOrFailed(rep, receivedData) && !mustSendLastChunk) {
context->writeComplete(context->clientConnection, NULL, 0, COMM_OK);
PROF_stop(clientSocketRecipient);
request->flags.canRePin = request->flags.sslBumped() && conn->pinning.pinned;
request->flags.ignore_cc = conn->port->ignore_cc;
// TODO: decouple http->flags.accel from request->flags.sslBumped
- request->flags.no_direct = (request->flags.accelerated && !request->flags.sslBumped()) ?
- !conn->port->allow_direct : 0;
+ if (request->flags.accelerated && !request->flags.sslBumped())
+ if (!conn->port->allow_direct)
+ request->flags.setNoDirect();
#if USE_AUTH
if (request->flags.sslBumped()) {
if (conn->auth_user_request != NULL)
if (http->flags.done_copying)
return 1;
- if (http->request->flags.chunked_reply && !flags.complete) {
+ if (http->request->flags.isReplyChunked() && !flags.complete) {
// last-chunk was not sent
return 0;
}
request->flags.proxy_keepalive &&
reply->bodySize(request->method) < 0) {
debugs(88, 3, "clientBuildReplyHeader: chunked reply");
- request->flags.chunked_reply = 1;
+ request->flags.markReplyChunked();
hdr->putStr(HDR_TRANSFER_ENCODING, "chunked");
}
debugs(88, 5, "clientReplyContext::sendStreamError: A stream error has occured, marking as complete and sending no data.");
StoreIOBuffer localTempBuffer;
flags.complete = 1;
- http->request->flags.stream_error = 1;
+ http->request->flags.setStreamError();
localTempBuffer.flags.error = result.flags.error;
clientStreamCallback((clientStreamNode*)http->client_stream.head->data, http, NULL,
localTempBuffer);
ps->acl_checklist = new ACLFilledChecklist(Config.accessList.NeverDirect, request, NULL);
ps->acl_checklist->nonBlockingCheck(peerCheckNeverDirectDone, ps);
return;
- } else if (request->flags.no_direct) {
+ } else if (request->flags.noDirect()) {
/** if we are accelerating, direct is not an option. */
ps->direct = DIRECT_NO;
debugs(44, 3, "peerSelectFoo: direct = " << DirectStr[ps->direct] << " (forced non-direct)");