Moved registration to receive request body from http and ftp into Server.
Ftp code was not setting the request body source member before this merge.
/*
- * $Id: Server.cc,v 1.22 2007/08/13 17:20:51 hno Exp $
+ * $Id: Server.cc,v 1.23 2007/09/27 14:34:06 rousskov Exp $
*
* DEBUG:
* AUTHOR: Duane Wessels
fwd->complete();
}
+// Register to receive request body
+bool ServerStateData::startRequestBodyFlow()
+{
+ HttpRequest *r = originalRequest();
+ assert(r->body_pipe != NULL);
+ requestBodySource = r->body_pipe;
+ if (requestBodySource->setConsumerIfNotLate(this)) {
+ debugs(11,3, HERE << "expecting request body from " <<
+ requestBodySource->status());
+ return true;
+ }
+
+ debugs(11,3, HERE << "aborting on partially consumed request body: " <<
+ requestBodySource->status());
+ requestBodySource = NULL;
+ return false;
+}
+
// Entry-dependent callbacks use this check to quit if the entry went bad
bool
ServerStateData::abortOnBadEntry(const char *abortReason)
/*
- * $Id: Server.h,v 1.9 2007/08/09 23:30:52 rousskov Exp $
+ * $Id: Server.h,v 1.10 2007/09/27 14:34:06 rousskov Exp $
*
* AUTHOR: Duane Wessels
*
virtual void completeForwarding(); // default calls fwd->complete()
// BodyConsumer for HTTP: consume request body.
+ bool startRequestBodyFlow();
void handleMoreRequestBodyAvailable();
void handleRequestBodyProductionEnded();
virtual void handleRequestBodyProducerAborted() = 0;
/*
- * $Id: ftp.cc,v 1.440 2007/08/15 06:56:19 amosjeffries Exp $
+ * $Id: ftp.cc,v 1.441 2007/09/27 14:34:06 rousskov Exp $
*
* DEBUG: section 9 File Transfer Protocol (FTP)
* AUTHOR: Harvest Derived
debugs(9, 3, "This is ftpReadStor");
if (code == 125 || (code == 150 && data.host)) {
- // register to receive body data
- assert(request->body_pipe != NULL);
- if (!request->body_pipe->setConsumerIfNotLate(this)) {
- debugs(9, 3, "ftpReadStor: aborting on partially consumed body");
+ if (!startRequestBodyFlow()) { // register to receive body data
ftpFail(this);
return;
}
/*
- * $Id: http.cc,v 1.537 2007/08/13 17:20:51 hno Exp $
+ * $Id: http.cc,v 1.538 2007/09/27 14:34:06 rousskov Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
maybeReadVirginBody();
if (orig_request->body_pipe != NULL) {
- requestBodySource = orig_request->body_pipe;
-
- if (!requestBodySource->setConsumerIfNotLate(this)) {
- debugs(32,3, HERE << "aborting on partially consumed body");
- requestBodySource = NULL;
+ if (!startRequestBodyFlow()) // register to receive body data
return false;
- }
-
requestSender = HttpStateData::sentRequestBodyWrapper;
- debugs(32,3, HERE << "expecting request body on pipe " << requestBodySource);
} else {
assert(!requestBodySource);
requestSender = HttpStateData::SendComplete;