Revision: 14700
Author: adrian.chadd
Date: Wed May 26 02:17:45 2010
Log: Use the refactored out HTTP URL assembly code.
http://code.google.com/p/lusca-cache/source/detail?r=14700
Modified:
/branches/LUSCA_HEAD/src/url.c
=======================================
--- /branches/LUSCA_HEAD/src/url.c Sun May 23 07:00:44 2010
+++ /branches/LUSCA_HEAD/src/url.c Wed May 26 02:17:45 2010
@@ -361,12 +361,7 @@
urlCanonicalClean(const request_t * request)
{
LOCAL_ARRAY(char, buf, MAX_URL);
- LOCAL_ARRAY(char, portbuf, 32);
- LOCAL_ARRAY(char, loginbuf, MAX_LOGIN_SZ + 1);
char *t;
- int i, j;
- const char *s;
- static const char ts[] = "://";
if (request->protocol == PROTO_URN) {
snprintf(buf, MAX_URL, "urn:%.*s", strLen2(request->urlpath),
strBuf2(request->urlpath));
@@ -376,48 +371,8 @@
snprintf(buf, 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);
- loginbuf[0] = '\0';
- if ((int) strlen(request->login) > 0) {
- strcpy(loginbuf, request->login);
- if ((t = strchr(loginbuf, ':')))
- *t = '\0';
- strcat(loginbuf, "@");
- }
- /*
- * This stuff would be better if/when each of these strings is a
String with
- * a known length..
- */
- s = ProtocolStr[request->protocol];
- for (i = 0; i < MAX_URL && *s != '\0'; i++, s++) {
- buf[i] = *s;
- }
- s = ts;
- for (; i < MAX_URL && *s != '\0'; i++, s++) {
- buf[i] = *s;
- }
- s = loginbuf;
- for (; i < MAX_URL && *s != '\0'; i++, s++) {
- buf[i] = *s;
- }
- s = request->host;
- for (; i < MAX_URL && *s != '\0'; i++, s++) {
- buf[i] = *s;
- }
- s = portbuf;
- for (; i < MAX_URL && *s != '\0'; i++, s++) {
- buf[i] = *s;
- }
- for (j = 0; i < MAX_URL && j < strLen2(request->urlpath); i++, j++)
{
- buf[i] = stringGetCh(&request->urlpath, j);
- }
- if (i >= (MAX_URL - 1)) {
- buf[MAX_URL - 1] = '\0';
- } else {
- buf[i] = '\0';
- }
+ (void) urlMakeHttpCanonical2(buf, request->protocol, request->login,
+ request->host, request->port, strBuf2(request->urlpath),
strLen2(request->urlpath));
/*
* strip arguments AFTER a question-mark
--
You received this message because you are subscribed to the Google Groups
"lusca-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/lusca-commit?hl=en.