/*
- * $Id: http.cc,v 1.83 1996/10/11 23:11:12 wessels Exp $
+ * $Id: http.cc,v 1.84 1996/10/15 05:45:36 wessels Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
char *Method = RequestMethodStr[req->method];
int buftype = 0;
StoreEntry *entry = httpState->entry;
+ int saw_host = 0;
debug(11, 5, "httpSendRequest: FD %d: httpState %p.\n", fd, httpState);
buflen = strlen(Method) + strlen(req->urlpath);
for (t = strtok(xbuf, crlf); t; t = strtok(NULL, crlf)) {
if (strncasecmp(t, "Connection:", 11) == 0)
continue;
+ if (strncasecmp(t, "Host:", 5) == 0)
+ saw_host = 1;
if (len + (int) strlen(t) > buflen - 10)
continue;
strcat(buf, t);
len += strlen(ybuf);
put_free_4k_page(ybuf);
}
+ /* Add Host: header */
+ if (!saw_host) {
+ ybuf = get_free_4k_page();
+ sprintf(ybuf, "Host: %s\r\n", req->host);
+ strcat(buf, ybuf);
+ len += strlen(ybuf);
+ put_free_4k_page(ybuf);
+ }
strcat(buf, crlf);
len += 2;
if (post_buf) {