-/* $Id: http.cc,v 1.34 1996/04/09 23:28:33 wessels Exp $ */
+/* $Id: http.cc,v 1.35 1996/04/10 00:18:49 wessels Exp $ */
/*
* DEBUG: Section 11 http: HTTP
StoreEntry *entry;
char host[SQUIDHOSTNAMELEN + 1];
int port;
- char *type;
+ int method;
char *req_hdr;
- char type_id;
char request[MAX_URL + 1];
char *icp_page_ptr; /* Used to send proxy-http request:
* put_free_8k_page(me) if the lifetime
t = strtok(NULL, "\n");
}
if (reply->code)
- debug(11, 3, "httpReadReply: HTTP CODE: %d\n", reply->code);
+ debug(11, 3, "httpProcessReplyHeader: HTTP CODE: %d\n", reply->code);
switch (reply->code) {
case 200: /* OK */
case 203: /* Non-Authoritative Information */
static char *HARVEST_PROXY_TEXT = "via Harvest Cache version";
int len = 0;
int buflen;
+ char *Method = RequestMethodStr[data->method];
debug(11, 5, "httpSendRequest: FD %d: data %p.\n", fd, data);
- buflen = strlen(data->type) + strlen(data->request);
+ buflen = strlen(Method) + strlen(data->request);
if (data->req_hdr)
buflen += strlen(data->req_hdr);
buflen += 512; /* lots of extra */
- if (!strcasecmp(data->type, "POST") && data->req_hdr) {
+ if (data->method == METHOD_POST && data->req_hdr) {
if ((t = strstr(data->req_hdr, "\r\n\r\n"))) {
post_buf = xstrdup(t + 4);
*(t + 4) = '\0';
}
memset(buf, '\0', buflen);
- sprintf(buf, "%s %s HTTP/1.0\r\n", data->type, data->request);
+ sprintf(buf, "%s %s HTTP/1.0\r\n", Method, data->request);
len = strlen(buf);
if (data->req_hdr) { /* we have to parse the request header */
xbuf = xstrdup(data->req_hdr);
data->entry = entry;
strncpy(data->request, url, sizeof(data->request) - 1);
- data->type = RequestMethodStr[entry->type_id];
+ data->method = entry->type_id;
data->port = e->ascii_port;
data->req_hdr = entry->mem_obj->mime_hdr;
strncpy(data->host, e->host, sizeof(data->host) - 1);
}
-int httpStart(unusedfd, url, type, req_hdr, entry)
+int httpStart(unusedfd, url, method, req_hdr, entry)
int unusedfd;
char *url;
- char *type;
+ int method;
char *req_hdr;
StoreEntry *entry;
{
int sock, status;
HttpData *data = NULL;
- debug(11, 3, "httpStart: %s <URL:%s>\n", type, url);
+ debug(11, 3, "httpStart: %s <URL:%s>\n", RequestMethodStr[method], url);
debug(11, 10, "httpStart: req_hdr '%s'\n", req_hdr);
data = (HttpData *) xcalloc(1, sizeof(HttpData));
data->entry = entry;
- data->type = type;
+ data->method = method;
data->req_hdr = req_hdr;
/* Parse url. */
-/* $Id: wais.cc,v 1.22 1996/04/09 23:28:37 wessels Exp $ */
+/* $Id: wais.cc,v 1.23 1996/04/10 00:18:50 wessels Exp $ */
/*
* DEBUG: Section 24 wais
StoreEntry *entry;
char host[SQUIDHOSTNAMELEN + 1];
int port;
- char *type;
+ int method;
char *mime_hdr;
- char type_id;
char request[MAX_URL];
} WAISData;
{
int len = strlen(data->request) + 4;
char *buf = NULL;
+ char *Method = RequestMethodStr[data->method];
debug(24, 5, "waisSendRequest - fd: %d\n", fd);
- if (data->type)
- len += strlen(data->type);
+ if (Method)
+ len += strlen(Method);
if (data->mime_hdr)
len += strlen(data->mime_hdr);
buf = (char *) xcalloc(1, len + 1);
if (data->mime_hdr)
- sprintf(buf, "%s %s %s\r\n", data->type, data->request,
+ sprintf(buf, "%s %s %s\r\n", Method, data->request,
data->mime_hdr);
else
- sprintf(buf, "%s %s\r\n", data->type, data->request);
+ sprintf(buf, "%s %s\r\n", Method, data->request);
debug(24, 6, "waisSendRequest - buf:%s\n", buf);
icpWrite(fd,
buf,
storeSetPublicKey(data->entry); /* Make it public */
}
-int waisStart(unusedfd, url, type, mime_hdr, entry)
+int waisStart(unusedfd, url, method, mime_hdr, entry)
int unusedfd;
char *url;
- char *type;
+ int method;
char *mime_hdr;
StoreEntry *entry;
{
int sock, status;
WAISData *data = NULL;
- debug(24, 3, "waisStart - url:%s, type:%s\n", url, type);
+ debug(24, 3, "waisStart - url:%s, type:%s\n", url, RequestMethodStr[method]);
debug(24, 4, " header: %s\n", mime_hdr);
data = (WAISData *) xcalloc(1, sizeof(WAISData));
}
/* Parse url. */
(void) wais_url_parser(url, data->host, &data->port, data->request);
- data->type = type;
+ data->method = method;
data->mime_hdr = mime_hdr;
/* Create socket. */