/*
- * $Id: ftp.cc,v 1.392 2006/04/27 19:27:37 wessels Exp $
+ * $Id: ftp.cc,v 1.393 2006/05/05 23:12:11 wessels Exp $
*
* DEBUG: section 9 File Transfer Protocol (FTP)
* AUTHOR: Harvest Derived
static void
ftpSendPasv(FtpStateData * ftpState)
{
- int fd;
struct sockaddr_in addr;
socklen_t addr_len;
+ debugs(9, 1, HERE << "ftpSendPasv");
+
if (ftpState->request->method == METHOD_HEAD) {
/* Terminate here for HEAD requests */
ftpState->appendSuccessHeader();
if (ftpState->data.fd >= 0) {
/* Close old connection */
- ftpState->transactionComplete();
+ comm_close(ftpState->data.fd);
+ ftpState->data.fd = -1;
}
if (!ftpState->flags.pasv_supported) {
addr_len = sizeof(addr);
+ debugs(9, 1, HERE << "ftpSendPasv");
+
if (getsockname(ftpState->ctrl.fd, (struct sockaddr *) &addr, &addr_len)) {
debug(9, 0) ("ftpSendPasv: getsockname(%d,..): %s\n",
ftpState->ctrl.fd, xstrerror());
}
/* Open data channel with the same local address as control channel */
- fd = comm_open(SOCK_STREAM,
- IPPROTO_TCP,
- addr.sin_addr,
- 0,
- COMM_NONBLOCKING,
- storeUrl(ftpState->entry));
+ int fd = comm_open(SOCK_STREAM,
+ IPPROTO_TCP,
+ addr.sin_addr,
+ 0,
+ COMM_NONBLOCKING,
+ storeUrl(ftpState->entry));
debug(9, 3) ("ftpSendPasv: Unconnected data socket created on FD %d\n", fd);
StoreEntry *e = entry;
HttpReply *newrep = new HttpReply;
+ debugs(0,0,HERE << "FtpStateData::appendSuccessHeader");
+
reply = HTTPMSGLOCK(newrep);
if (flags.http_header_sent)
debugs(9,5,HERE << "writing " << len << " bytes to StoreEntry");
+ //debugs(9,5,HERE << data);
+
storeAppend(entry, data, len);
}
if (service == NULL) {
// handle case where no service is selected;
- debugs(0,0,HERE << "write me");
+ entry->replaceHttpReply(reply);
processReplyBody();
return;
}