From: wessels <> Date: Tue, 9 Dec 1997 11:02:08 +0000 (+0000) Subject: force menu option X-Git-Tag: SQUID_3_0_PRE1~4361 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fa040df249bdc6d35f61cd5fb393e3591357c8b7;p=thirdparty%2Fsquid.git force menu option --- diff --git a/src/urn.cc b/src/urn.cc index 5a4fd87f3b..0f065e1d9f 100644 --- a/src/urn.cc +++ b/src/urn.cc @@ -33,10 +33,15 @@ static STCB urnHandleReply; static wordlist *urnParseReply(const char *inbuf); static const char *const crlf = "\r\n"; +enum { + URN_FORCE_MENU +}; + typedef struct { StoreEntry *entry; StoreEntry *urlres_e; request_t *request; + int flags; } UrnState; wordlist * @@ -89,22 +94,24 @@ urnStart(request_t *r, StoreEntry *e) UrnState *urnState; StoreEntry *urlres_e; debug(50, 3) ("urnStart: '%s'\n", storeUrl(e)); - t = strchr(r->urlpath, ':'); - if (t == NULL) { - ErrorState *err = errorCon(ERR_URN_RESOLVE, HTTP_NOT_FOUND); - err->request = requestLink(r); - err->url = xstrdup(storeUrl(e)); - errorAppendEntry(e, err); - return; - } - *t = '\0'; - host = xstrdup(r->urlpath); - *t = ':'; urnState = xcalloc(1, sizeof(UrnState)); urnState->entry = e; urnState->request = requestLink(r); cbdataAdd(urnState); storeLockObject(urnState->entry); + if ((t = strchr(r->urlpath, ':')) != NULL) { + *t = '\0'; + host = xstrdup(r->urlpath); + *t = ':'; + } else { + host = xstrdup(r->urlpath); + } + if (strncasecmp(host, "menu.", 5) == 0) { + EBIT_SET(urnState->flags, URN_FORCE_MENU); + t = xstrdup(host + 5); + xfree(host); + host = t; + } snprintf(urlres, 4096, "http://%s/uri-res/N2L?urn:%s", host, r->urlpath); safe_free(host); k = storeKeyPublic(urlres, METHOD_GET); @@ -225,7 +232,9 @@ urnHandleReply(void *data, char *buf, ssize_t size) squid_curtime); storeAppend(e, hdr, strlen(hdr)); httpParseReplyHeaders(hdr, e->mem_obj->reply); - if (min_w) { + if (EBIT_TEST(urnState->flags, URN_FORCE_MENU)) { + debug(51,3)("urnHandleReply: forcing menu\n"); + } else if (min_w) { l = snprintf(line, 4096, "Location: %s\r\n", min_w->key); storeAppend(e, line, l); }