/*
- * $Id: http.cc,v 1.393 2002/09/24 10:46:42 robertc Exp $
+ * $Id: http.cc,v 1.394 2002/10/04 09:53:35 hno Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
static void httpMakePublic(StoreEntry *);
static int httpCachableReply(HttpStateData *);
static void httpMaybeRemovePublic(StoreEntry *, http_status);
+static mb_size_t httpBuildRequestPrefix(request_t * request,
+ request_t * orig_request,
+ StoreEntry * entry,
+ MemBuf * mb,
+ http_state_flags);
+static void httpProcessReplyHeader(HttpStateData *, const char *, int);
static void
httpStateFree(int fd, void *data)
request_t * orig_request,
StoreEntry * entry,
HttpHeader * hdr_out,
- int cfd,
http_state_flags flags)
{
/* building buffer for complex strings */
}
/* append X-Forwarded-For */
strFwd = httpHeaderGetList(hdr_in, HDR_X_FORWARDED_FOR);
- strListAdd(&strFwd, (cfd < 0 ? "unknown" : fd_table[cfd].ipaddr), ',');
+ if (opt_forwarded_for && orig_request->client_addr.s_addr != no_addr.s_addr)
+ strListAdd(&strFwd, inet_ntoa(orig_request->client_addr), ',');
+ else
+ strListAdd(&strFwd, "unknown", ',');
httpHeaderPutStr(hdr_out, HDR_X_FORWARDED_FOR, strBuf(strFwd));
stringClean(&strFwd);
request_t * orig_request,
StoreEntry * entry,
MemBuf * mb,
- int cfd,
http_state_flags flags)
{
const int offset = mb->size;
{
HttpHeader hdr;
Packer p;
- httpBuildRequestHeader(request, orig_request, entry, &hdr, cfd, flags);
+ httpBuildRequestHeader(request, orig_request, entry, &hdr, flags);
packerToMemInit(&p, mb);
httpHeaderPackInto(&hdr, &p);
httpHeaderClean(&hdr);
MemBuf mb;
request_t *req = httpState->request;
StoreEntry *entry = httpState->entry;
- int cfd;
peer *p = httpState->_peer;
CWCB *sendHeaderDone;
else
sendHeaderDone = httpSendComplete;
- if (!opt_forwarded_for)
- cfd = -1;
- else if (entry->mem_obj == NULL)
- cfd = -1;
- else
- cfd = entry->mem_obj->fd;
- assert(-1 == cfd || FD_SOCKET == fd_table[cfd].type);
if (p != NULL)
httpState->flags.proxying = 1;
else
httpState->orig_request,
entry,
&mb,
- cfd,
httpState->flags);
debug(11, 6) ("httpSendRequest: FD %d:\n%s\n", httpState->fd, mb.buf);
comm_write_mbuf(httpState->fd, mb, sendHeaderDone, httpState);
/*
- * $Id: protos.h,v 1.449 2002/10/03 06:45:53 hno Exp $
+ * $Id: protos.h,v 1.450 2002/10/04 09:53:35 hno Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
extern void httpRequestFree(void *);
extern void clientAccessCheck(void *);
-extern aclCheck_t * clientAclChecklistCreate(const acl_access * acl, const clientHttpRequest * http);
+extern aclCheck_t *clientAclChecklistCreate(const acl_access * acl, const clientHttpRequest * http);
/* client_side_reply.c - client side reply related routines (pure logic, no comms) */
extern void *clientReplyNewContext(clientHttpRequest *);
/* http.c */
extern int httpCachable(method_t);
extern void httpStart(FwdState *);
-extern void httpParseReplyHeaders(const char *, http_reply *);
-extern void httpProcessReplyHeader(HttpStateData *, const char *, int);
-extern mb_size_t httpBuildRequestPrefix(request_t * request,
- request_t * orig_request,
- StoreEntry * entry,
- MemBuf * mb,
- int cfd,
- http_state_flags);
extern void httpAnonInitModule(void);
extern int httpAnonHdrAllowed(http_hdr_type hdr_id);
extern int httpAnonHdrDenied(http_hdr_type hdr_id);
-extern void httpBuildRequestHeader(request_t *, request_t *, StoreEntry *, HttpHeader *, int, http_state_flags);
+extern void httpBuildRequestHeader(request_t *, request_t *, StoreEntry *, HttpHeader *, http_state_flags);
extern void httpBuildVersion(http_version_t * version, unsigned int major, unsigned int minor);
extern const char *httpMakeVaryMark(request_t * request, HttpReply * reply);