/*
- * $Id: acl.cc,v 1.169 1998/07/14 22:28:08 wessels Exp $
+ * $Id: acl.cc,v 1.170 1998/07/16 22:22:46 wessels Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
return k;
/* NOTREACHED */
case ACL_URL_REGEX:
- esc_buf = xstrdup(urlCanonical(r, NULL));
+ esc_buf = xstrdup(urlCanonical(r));
rfc1738_unescape(esc_buf);
k = aclMatchRegex(acl->data, esc_buf);
safe_free(esc_buf);
/*
- * $Id: client_side.cc,v 1.354 1998/07/16 03:46:47 wessels Exp $
+ * $Id: client_side.cc,v 1.355 1998/07/16 22:22:47 wessels Exp $
*
* DEBUG: section 33 Client-side Routines
* AUTHOR: Duane Wessels
debug(33, 5) ("clientAccessCheckDone: '%s' answer=%d\n", http->uri, answer);
http->acl_checklist = NULL;
if (answer == ACCESS_ALLOWED) {
- urlCanonical(http->request, http->uri);
+ safe_free(http->uri);
+ http->uri = xstrdup(urlCanonical(http->request));
assert(http->redirect_state == REDIRECT_NONE);
http->redirect_state = REDIRECT_PENDING;
redirectStart(http, clientRedirectDone, http);
clientRedirectDone(void *data, char *result)
{
clientHttpRequest *http = data;
- size_t l;
request_t *new_request = NULL;
request_t *old_request = http->request;
debug(33, 5) ("clientRedirectDone: '%s' result=%s\n", http->uri,
new_request = urlParse(old_request->method, result);
if (new_request) {
safe_free(http->uri);
- /* need to malloc because the URL returned by the redirector might
- * not be big enough to append the local domain
- * -- David Lamkin drl@net-tel.co.uk */
- l = strlen(result) + Config.appendDomainLen + 64;
- http->uri = xcalloc(l, 1);
- xstrncpy(http->uri, result, l);
+ http->uri = xstrdup(urlCanonical(new_request));
new_request->http_ver = old_request->http_ver;
httpHeaderAppend(&new_request->header, &old_request->header);
new_request->client_addr = old_request->client_addr;
}
requestUnlink(old_request);
http->request = requestLink(new_request);
- urlCanonical(http->request, http->uri);
}
clientInterpretRequestHeaders(http);
fd_note(http->conn->fd, http->uri);
/*
- * $Id: http.cc,v 1.290 1998/06/29 19:29:01 wessels Exp $
+ * $Id: http.cc,v 1.291 1998/07/16 22:22:49 wessels Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
if (!cc)
cc = httpHdrCcCreate();
if (!EBIT_TEST(cc->mask, CC_MAX_AGE)) {
- const char *url = entry ? storeUrl(entry) : urlCanonical(orig_request, NULL);
+ const char *url = entry ? storeUrl(entry) : urlCanonical(orig_request);
httpHdrCcSetMaxAge(cc, getMaxAge(url));
if (strLen(request->urlpath))
assert(strstr(url, strBuf(request->urlpath)));
/*
- * $Id: peer_select.cc,v 1.68 1998/06/30 07:11:11 wessels Exp $
+ * $Id: peer_select.cc,v 1.69 1998/07/16 22:22:50 wessels Exp $
*
* DEBUG: section 44 Peer Selection Algorithm
* AUTHOR: Duane Wessels
{
request_t *request = psstate->request;
void *data = psstate->callback_data;
- const char *url = psstate->entry ? storeUrl(psstate->entry) : urlCanonical(request, NULL);
+ const char *url = psstate->entry ? storeUrl(psstate->entry) : urlCanonical(request);
debug(44, 1) ("Failed to select source for '%s'\n", url);
debug(44, 1) (" always_direct = %d\n", psstate->always_direct);
debug(44, 1) (" never_direct = %d\n", psstate->never_direct);
extern method_t urlParseMethod(const char *);
extern void urlInitialize(void);
extern request_t *urlParse(method_t, char *);
-extern char *urlCanonical(const request_t *, char *);
+extern char *urlCanonical(const request_t *);
extern char *urlRInternal(const char *host, u_short port, const char *dir, const char *name);
extern char *urlInternal(const char *dir, const char *name);
extern int matchDomainName(const char *d, const char *h);
/*
- * $Id: refresh.cc,v 1.22 1998/07/14 21:25:51 wessels Exp $
+ * $Id: refresh.cc,v 1.23 1998/07/16 22:22:52 wessels Exp $
*
* DEBUG: section 22 Refresh Calculation
* AUTHOR: Harvest Derived
refreshCheck(const StoreEntry * entry, const request_t * request, time_t delta)
{
const refresh_t *R;
+ const char *uri;
time_t min = REFRESH_DEFAULT_MIN;
double pct = REFRESH_DEFAULT_PCT;
time_t max = REFRESH_DEFAULT_MAX;
time_t age;
double factor;
time_t check_time = squid_curtime + delta;
- assert(entry->mem_obj);
- assert(entry->mem_obj->url);
- debug(22, 3) ("refreshCheck: '%s'\n", entry->mem_obj->url);
+ if (entry->mem_obj)
+ uri = entry->mem_obj->url;
+ else
+ uri = urlCanonical(request);
+ debug(22, 3) ("refreshCheck: '%s'\n", uri);
if (EBIT_TEST(entry->flag, ENTRY_REVALIDATE)) {
debug(22, 3) ("refreshCheck: YES: Required Authorization\n");
return 1;
}
- if ((R = refreshLimits(entry->mem_obj->url))) {
+ if ((R = refreshLimits(uri))) {
min = R->min;
pct = R->pct;
max = R->max;
/*
- * $Id: ssl.cc,v 1.81 1998/06/09 21:18:53 wessels Exp $
+ * $Id: ssl.cc,v 1.82 1998/07/16 22:22:53 wessels Exp $
*
* DEBUG: section 26 Secure Sockets Layer Proxy
* AUTHOR: Duane Wessels
}
} else if (len == 0) {
/* Connection closed; retrieval done. */
+#if DONT
sslClose(sslState);
+#endif
} else {
sslState->client.offset = 0;
sslState->client.len = len;
char user_ident[USER_IDENT_SZ]; /* from proxy auth or ident server */
u_short port;
String urlpath;
+ char *canonical;
int link_count; /* free when zero */
int flags;
HttpHdrCc *cache_control;
/*
- * $Id: tunnel.cc,v 1.81 1998/06/09 21:18:53 wessels Exp $
+ * $Id: tunnel.cc,v 1.82 1998/07/16 22:22:53 wessels Exp $
*
* DEBUG: section 26 Secure Sockets Layer Proxy
* AUTHOR: Duane Wessels
}
} else if (len == 0) {
/* Connection closed; retrieval done. */
+#if DONT
sslClose(sslState);
+#endif
} else {
sslState->client.offset = 0;
sslState->client.len = len;
/*
- * $Id: url.cc,v 1.98 1998/07/15 23:56:24 wessels Exp $
+ * $Id: url.cc,v 1.99 1998/07/16 22:22:55 wessels Exp $
*
* DEBUG: section 23 URL Parsing
* AUTHOR: Duane Wessels
void
urlInitialize(void)
{
- int i;
debug(23, 5) ("urlInitialize: Initializing...\n");
assert(sizeof(ProtocolStr) == (PROTO_MAX + 1) * sizeof(char *));
}
}
char *
-urlCanonical(const request_t * request, char *buf)
+urlCanonical(const request_t * request)
{
- LOCAL_ARRAY(char, urlbuf, MAX_URL);
LOCAL_ARRAY(char, portbuf, 32);
- if (buf == NULL)
- buf = urlbuf;
+ LOCAL_ARRAY(char, urlbuf, MAX_URL);
+ if (request->canonical)
+ return request->canonical;
if (request->protocol == PROTO_URN) {
- snprintf(buf, MAX_URL, "urn:%s", strBuf(request->urlpath));
- } else
+ snprintf(urlbuf, MAX_URL, "urn:%s", strBuf(request->urlpath));
+ } else {
switch (request->method) {
case METHOD_CONNECT:
- snprintf(buf, MAX_URL, "%s:%d", request->host, request->port);
+ snprintf(urlbuf, MAX_URL, "%s:%d", request->host, request->port);
break;
default:
portbuf[0] = '\0';
if (request->port != urlDefaultPort(request->protocol))
snprintf(portbuf, 32, ":%d", request->port);
- snprintf(buf, MAX_URL, "%s://%s%s%s%s%s",
+ snprintf(urlbuf, MAX_URL, "%s://%s%s%s%s%s",
ProtocolStr[request->protocol],
request->login,
*request->login ? "@" : null_string,
strBuf(request->urlpath));
break;
}
- return buf;
+ }
+ return request->canonical = xstrdup(urlbuf);
}
char *
#endif
safe_free(request->body);
stringClean(&request->urlpath);
+ safe_free(request->canonical);
memFree(MEM_REQUEST_T, request);
}
#endif