/*
- * $Id: HttpReply.cc,v 1.29 1998/07/22 20:36:49 wessels Exp $
+ * $Id: HttpReply.cc,v 1.30 1998/08/14 19:25:11 wessels Exp $
*
* DEBUG: section 58 HTTP Reply (Response)
* AUTHOR: Alex Rousskov
{
static const http_hdr_type ImsEntries[] =
{HDR_DATE, HDR_CONTENT_LENGTH, HDR_CONTENT_TYPE, HDR_EXPIRES, HDR_LAST_MODIFIED, /* eof */ HDR_OTHER};
- http_hdr_type t;
+ int t;
MemBuf mb;
Packer p;
HttpHeaderEntry *e;
/*
- * $Id: HttpStatusLine.cc,v 1.16 1998/08/10 19:37:47 wessels Exp $
+ * $Id: HttpStatusLine.cc,v 1.17 1998/08/14 19:25:12 wessels Exp $
*
* DEBUG: section 57 HTTP Status-line
* AUTHOR: Alex Rousskov
void
httpStatusLineInit(HttpStatusLine * sline)
{
- httpStatusLineSet(sline, 0.0, 0, NULL);
+ httpStatusLineSet(sline, 0.0, HTTP_STATUS_NONE, NULL);
}
void
httpStatusLineClean(HttpStatusLine * sline)
{
- httpStatusLineSet(sline, 0.0, 500, NULL);
+ httpStatusLineSet(sline, 0.0, HTTP_INTERNAL_SERVER_ERROR, NULL);
}
/* set values */
/*
- * $Id: acl.cc,v 1.174 1998/07/31 00:15:33 wessels Exp $
+ * $Id: acl.cc,v 1.175 1998/08/14 19:25:13 wessels Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
default:
debug(28, 0) ("decode_addr: Invalid IP address '%s'\n", asc);
return 0; /* This is not valid address */
- break;
}
if (mask != NULL) { /* mask == NULL if called to decode a netmask */
/*
- * $Id: cachemgr.cc,v 1.81 1998/07/22 20:37:03 wessels Exp $
+ * $Id: cachemgr.cc,v 1.82 1998/08/14 19:25:14 wessels Exp $
*
* DEBUG: section 0 CGI Cache Manager
* AUTHOR: Duane Wessels
static const char *ttags[] =
{"td", "th"};
static char html[4096];
- static table_line_num = 0;
- static next_is_header = 0;
+ static int table_line_num = 0;
+ static int next_is_header = 0;
int is_header = 0;
const char *ttag;
char *buf_copy;
/*
- * $Id: client_side.cc,v 1.376 1998/08/14 09:22:32 wessels Exp $
+ * $Id: client_side.cc,v 1.377 1998/08/14 19:25:15 wessels Exp $
*
* DEBUG: section 33 Client-side Routines
* AUTHOR: Duane Wessels
if (entry)
mem = entry->mem_obj;
if (http->out.size || http->log_type) {
- http->al.icp.opcode = 0;
+ http->al.icp.opcode = ICP_INVALID;
http->al.url = http->log_uri;
debug(33, 9) ("httpRequestFree: al.url='%s'\n", http->al.url);
if (mem) {
/*
- * $Id: enums.h,v 1.113 1998/07/31 00:15:42 wessels Exp $
+ * $Id: enums.h,v 1.114 1998/08/14 19:25:17 wessels Exp $
*
*
* SQUID Internet Object Cache http://squid.nlanr.net/Squid/
} protocol_t;
typedef enum {
+ HTTP_STATUS_NONE = 0,
HTTP_CONTINUE = 100,
HTTP_SWITCHING_PROTOCOLS = 101,
HTTP_OK = 200,
HTTP_INVALID_HEADER = 600 /* Squid header parsing error */
} http_status;
-enum {
+typedef enum {
PD_INITED, /* initialized */
PD_USABLE, /* ready to use */
PD_REQUESTED, /* we are in the process of receiving a [fresh] digest */
/*
- * $Id: errorpage.cc,v 1.140 1998/07/22 20:37:17 wessels Exp $
+ * $Id: errorpage.cc,v 1.141 1998/08/14 19:25:18 wessels Exp $
*
* DEBUG: section 4 Error Generation
* AUTHOR: Duane Wessels
void
errorInitialize(void)
{
- int i;
+ err_type i;
const char *text;
error_page_count = ERR_MAX + ErrorDynamicPages.count;
error_text = xcalloc(error_page_count, sizeof(char *));
- for (i = ERR_NONE + 1; i < error_page_count; i++) {
+ for (i = ERR_NONE, i++; i < error_page_count; i++) {
safe_free(error_text[i]);
/* hard-coded ? */
if ((text = errorFindHardText(i)))
* Abstract: This function creates a ErrorState object.
*/
ErrorState *
-errorCon(int type, http_status status)
+errorCon(err_type type, http_status status)
{
ErrorState *err = xcalloc(1, sizeof(ErrorState));
err->page_id = type; /* has to be reset manually if needed */
/*
- * $Id: ftp.cc,v 1.243 1998/08/14 09:22:35 wessels Exp $
+ * $Id: ftp.cc,v 1.244 1998/08/14 19:25:19 wessels Exp $
*
* DEBUG: section 9 File Transfer Protocol (FTP)
* AUTHOR: Harvest Derived
{
ErrorState *err;
int code = ftpState->ctrl.replycode;
- int http_code;
- int err_code = ERR_NONE;
+ http_status http_code;
+ err_type err_code = ERR_NONE;
debug(9, 5) ("ftpSendReply: %s, code %d\n",
storeUrl(ftpState->entry), code);
if (cbdataValid(ftpState))
/*
- * $Id: http.cc,v 1.305 1998/08/14 09:22:37 wessels Exp $
+ * $Id: http.cc,v 1.306 1998/08/14 19:25:20 wessels Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
if (hdr_len > 4 && strncmp(httpState->reply_hdr, "HTTP/", 5)) {
debug(11, 3) ("httpProcessReplyHeader: Non-HTTP-compliant header: '%s'\n", httpState->reply_hdr);
httpState->reply_hdr_state += 2;
- reply->sline.status = 555;
+ reply->sline.status = HTTP_INVALID_HEADER;
return;
}
t = httpState->reply_hdr + hdr_len;
/*
- * $Id: icp_v2.cc,v 1.46 1998/07/22 20:53:57 wessels Exp $
+ * $Id: icp_v2.cc,v 1.47 1998/08/14 19:25:21 wessels Exp $
*
* DEBUG: section 12 Internet Cache Protocol
* AUTHOR: Duane Wessels
* count this DENIED query in the clientdb, even though
* we're not sending an ICP reply...
*/
- clientdbUpdate(from.sin_addr, LOG_UDP_DENIED, Config.Port.icp, 0);
+ clientdbUpdate(from.sin_addr, LOG_UDP_DENIED, PROTO_ICP, 0);
} else {
reply = icpCreateMessage(ICP_DENIED, 0, url, header.reqnum, 0);
icpUdpSend(fd, &from, reply, LOG_UDP_DENIED, 0);
/*
- * $Id: icp_v3.cc,v 1.22 1998/07/22 20:53:58 wessels Exp $
+ * $Id: icp_v3.cc,v 1.23 1998/08/14 19:25:22 wessels Exp $
*
* DEBUG: section 12 Internet Cache Protocol
* AUTHOR: Duane Wessels
* count this DENIED query in the clientdb, even though
* we're not sending an ICP reply...
*/
- clientdbUpdate(from.sin_addr, LOG_UDP_DENIED, Config.Port.icp, 0);
+ clientdbUpdate(from.sin_addr, LOG_UDP_DENIED, PROTO_ICP, 0);
} else {
reply = icpCreateMessage(ICP_DENIED, 0, url, header.reqnum, 0);
icpUdpSend(fd, &from, reply, LOG_UDP_DENIED, 0);
/*
- * $Id: mem.cc,v 1.30 1998/07/22 20:37:34 wessels Exp $
+ * $Id: mem.cc,v 1.31 1998/08/14 19:25:23 wessels Exp $
*
* DEBUG: section 13 High Level Memory Pool Management
* AUTHOR: Harvest Derived
memDataInit(MEM_WORDLIST, "wordlist", sizeof(wordlist), 0);
memDataInit(MEM_CLIENT_INFO, "ClientInfo", sizeof(ClientInfo), 0);
/* test that all entries are initialized */
- for (t = MEM_NONE + 1; t < MEM_MAX; t++) {
+ for (t = MEM_NONE, t++; t < MEM_MAX; t++) {
if (MEM_DONTFREE == t)
continue;
/*
/*
- * $Id: mime.cc,v 1.73 1998/07/22 20:37:35 wessels Exp $
+ * $Id: mime.cc,v 1.74 1998/08/14 19:25:24 wessels Exp $
*
* DEBUG: section 25 MIME Parsing
* AUTHOR: Harvest Derived
assert(e != NULL);
e->mem_obj->request = requestLink(urlParse(METHOD_GET, url));
httpReplyReset(e->mem_obj->reply);
- httpReplySetHeaders(e->mem_obj->reply, 1.0, 200, NULL,
+ httpReplySetHeaders(e->mem_obj->reply, 1.0, HTTP_OK, NULL,
type, (int) sb.st_size, sb.st_mtime, squid_curtime + 86400);
httpReplySwapOut(e->mem_obj->reply, e);
/* read the file into the buffer and append it to store */