[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r581 - GNUnet/src/applications/bootstrap_http
From: |
durner |
Subject: |
[GNUnet-SVN] r581 - GNUnet/src/applications/bootstrap_http |
Date: |
Sun, 3 Apr 2005 05:06:00 -0700 (PDT) |
Author: durner
Date: 2005-04-03 05:05:55 -0700 (Sun, 03 Apr 2005)
New Revision: 581
Modified:
GNUnet/src/applications/bootstrap_http/http.c
Log:
improvements
Modified: GNUnet/src/applications/bootstrap_http/http.c
===================================================================
--- GNUnet/src/applications/bootstrap_http/http.c 2005-04-03 01:33:51 UTC
(rev 580)
+++ GNUnet/src/applications/bootstrap_http/http.c 2005-04-03 12:05:55 UTC
(rev 581)
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet.
- (C) 2001, 2002, 2003, 2004 Christian Grothoff (and other contributing
authors)
+ (C) 2001, 2002, 2003, 2004, 2005 Christian Grothoff (and other
contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
@@ -51,7 +51,7 @@
unsigned short port;
char * hostname;
char * filename;
- unsigned int curpos;
+ unsigned int curpos, lenHostname, lenUrl;
struct hostent *ip_info;
struct sockaddr_in soaddr;
int sock;
@@ -73,23 +73,25 @@
}
curpos = strlen(HTTP_URL);
hostname = &url[curpos];
- while ( (curpos < strlen(url)) &&
+ lenUrl = strlen(url);
+ while ( (curpos < lenUrl) &&
(url[curpos] != '/') )
curpos++;
- if (curpos == strlen(url))
+ if (curpos == lenUrl)
filename = STRDUP("/");
else
filename = STRDUP(&url[curpos]);
url[curpos] = '\0'; /* terminator for hostname */
curpos = 0;
- while ( (curpos < strlen(hostname)) &&
+ lenHostname = strlen(hostname);
+ while ( (curpos < lenHostname) &&
(hostname[curpos] != ':') )
curpos++;
- if (curpos == strlen(hostname))
+ if (curpos == lenHostname)
port = TCP_HTTP_PORT;
else
- port = atoi(STRDUP(&hostname[curpos+1]));
+ port = atoi(hostname + curpos + 1);
hostname[curpos] = '\0'; /* terminator for hostname */
@@ -141,7 +143,8 @@
return;
}
- n = strlen(filename) + strlen(GET_COMMAND) + strlen(hostname) + 10;
+ /* 10: 1 + sizeof(port) */
+ n = strlen(filename) + strlen(GET_COMMAND) + lenHostname + 10;
command = MALLOC(n);
SNPRINTF(command,
n,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r581 - GNUnet/src/applications/bootstrap_http,
durner <=