--------------------- PatchSet 10234 Date: 2007/12/13 14:01:46 Author: adri Branch: s27_adri Tag: (none) Log: strBuf() -> strBuf2() in the gopher code. Untested. Members: src/gopher.c:1.26.12.1->1.26.12.2 Index: squid/src/gopher.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/gopher.c,v retrieving revision 1.26.12.1 retrieving revision 1.26.12.2 diff -u -r1.26.12.1 -r1.26.12.2 --- squid/src/gopher.c 12 Dec 2007 09:34:28 -0000 1.26.12.1 +++ squid/src/gopher.c 13 Dec 2007 14:01:46 -0000 1.26.12.2 @@ -1,6 +1,6 @@ /* - * $Id: gopher.c,v 1.26.12.1 2007/12/12 09:34:28 adri Exp $ + * $Id: gopher.c,v 1.26.12.2 2007/12/13 14:01:46 adri Exp $ * * DEBUG: section 10 Gopher * AUTHOR: Harvest Derived @@ -181,22 +181,22 @@ static void gopher_request_parse(const request_t * req, char *type_id, char *request) { - const char *path = strBuf(req->urlpath); + int i = 0; if (request) request[0] = '\0'; - if (path && (*path == '/')) - path++; + if (strIsNotNull(req->urlpath) && (strLen2(req->urlpath) > 0) && strGetPos(req->urlpath, 0) == '/') + i = 1; - if (!path || !*path) { + if (strIsNull(req->urlpath) || strLen2(req->urlpath) == i) { *type_id = GOPHER_DIRECTORY; return; } - *type_id = path[0]; + *type_id = strGetPos(req->urlpath, i); if (request) { - xstrncpy(request, path + 1, MAX_URL); + xstrncpy(request, strBuf2(req->urlpath) + i + 1, XMIN(MAX_URL, strLen2(req->urlpath) - i - 1)); /* convert %xx to char */ url_convert_hex(request, 0); }