dgaudet 97/04/11 21:25:05
Modified: src http_config.c http_core.c http_main.c
http_protocol.c httpd.h mod_imap.c mod_info.c
mod_log_config.c util.c util_script.c
Log:
More signed/unsigned port cleanups.
Reviewed by: Roy, Chuck
Revision Changes Path
1.48 +1 -1 apache/src/http_config.c
Index: http_config.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_config.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -C3 -r1.47 -r1.48
*** http_config.c 1997/03/22 23:51:01 1.47
--- http_config.c 1997/04/12 04:24:56 1.48
***************
*** 849,855 ****
* *paddr is the variable used to keep track of **paddr between calls
* port is the default port to assume
*/
! static void get_addresses (pool *p, char *w, server_addr_rec ***paddr, int
port)
{
struct hostent *hep;
unsigned long my_addr;
--- 849,855 ----
* *paddr is the variable used to keep track of **paddr between calls
* port is the default port to assume
*/
! static void get_addresses (pool *p, char *w, server_addr_rec ***paddr,
unsigned port)
{
struct hostent *hep;
unsigned long my_addr;
1.77 +1 -1 apache/src/http_core.c
Index: http_core.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_core.c,v
retrieving revision 1.76
retrieving revision 1.77
diff -C3 -r1.76 -r1.77
*** http_core.c 1997/04/06 07:43:40 1.76
--- http_core.c 1997/04/12 04:24:56 1.77
***************
*** 1108,1114 ****
{
listen_rec *new;
char *ports;
! int port;
if (cmd->server->is_virtual) return "Listen not allowed in
<VirtualHost>";
ports=strchr(ips, ':');
--- 1108,1114 ----
{
listen_rec *new;
char *ports;
! unsigned port;
if (cmd->server->is_virtual) return "Listen not allowed in
<VirtualHost>";
ports=strchr(ips, ':');
1.137 +3 -3 apache/src/http_main.c
Index: http_main.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_main.c,v
retrieving revision 1.136
retrieving revision 1.137
diff -C3 -r1.136 -r1.137
*** http_main.c 1997/04/07 09:59:50 1.136
--- http_main.c 1997/04/12 04:24:57 1.137
***************
*** 1476,1483 ****
pool *pconf; /* Pool for config stuff */
pool *ptrans; /* Pool for per-transaction stuff */
! server_rec *find_virtual_server (struct in_addr server_ip, int port,
! server_rec *server)
{
server_rec *virt;
server_addr_rec *sar;
--- 1476,1483 ----
pool *pconf; /* Pool for config stuff */
pool *ptrans; /* Pool for per-transaction stuff */
! static server_rec *find_virtual_server (struct in_addr server_ip,
! unsigned port, server_rec *server)
{
server_rec *virt;
server_addr_rec *sar;
***************
*** 1513,1519 ****
int n;
server_addr_rec *sar;
int has_default_vhost_addr;
! int mainport = s->port;
int from_local=0;
/* Main host first */
--- 1513,1519 ----
int n;
server_addr_rec *sar;
int has_default_vhost_addr;
! unsigned mainport = s->port;
int from_local=0;
/* Main host first */
1.113 +3 -2 apache/src/http_protocol.c
Index: http_protocol.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_protocol.c,v
retrieving revision 1.112
retrieving revision 1.113
diff -C3 -r1.112 -r1.113
*** http_protocol.c 1997/04/07 10:58:39 1.112
--- http_protocol.c 1997/04/12 04:24:57 1.113
***************
*** 547,553 ****
const char *check_fulluri (request_rec *r, const char *uri) {
char *name, *host;
! int i, port;
/* This routine parses full URLs, if they match the server */
if (strncmp(uri, "http://", 7)) return uri;
--- 547,554 ----
const char *check_fulluri (request_rec *r, const char *uri) {
char *name, *host;
! int i;
! unsigned port;
/* This routine parses full URLs, if they match the server */
if (strncmp(uri, "http://", 7)) return uri;
***************
*** 674,680 ****
static void check_hostalias (request_rec *r) {
const char *hostname=r->hostname;
char *host = getword(r->pool, &hostname, ':'); /* Get rid of port */
! int port = (*hostname) ? atoi(hostname) : 80;
server_rec *s;
int l;
--- 675,681 ----
static void check_hostalias (request_rec *r) {
const char *hostname=r->hostname;
char *host = getword(r->pool, &hostname, ':'); /* Get rid of port */
! unsigned port = (*hostname) ? atoi(hostname) : 80;
server_rec *s;
int l;
1.96 +2 -2 apache/src/httpd.h
Index: httpd.h
===================================================================
RCS file: /export/home/cvs/apache/src/httpd.h,v
retrieving revision 1.95
retrieving revision 1.96
diff -C3 -r1.95 -r1.96
*** httpd.h 1997/04/08 04:06:03 1.95
--- httpd.h 1997/04/12 04:24:58 1.96
***************
*** 665,671 ****
char *os_escape_path(pool *p,const char *path,int partial);
#define escape_uri(ppool,path) os_escape_path(ppool,path,1)
extern char *escape_html(pool *p, const char *s);
! char *construct_server(pool *p, const char *hostname, int port);
char *construct_url (pool *p, const char *path, const server_rec *s);
char *escape_shell_cmd (pool *p, const char *s);
--- 665,671 ----
char *os_escape_path(pool *p,const char *path,int partial);
#define escape_uri(ppool,path) os_escape_path(ppool,path,1)
extern char *escape_html(pool *p, const char *s);
! char *construct_server(pool *p, const char *hostname, unsigned port);
char *construct_url (pool *p, const char *path, const server_rec *s);
char *escape_shell_cmd (pool *p, const char *s);
***************
*** 700,705 ****
void chdir_file(const char *file);
char *get_local_host(pool *);
! unsigned long get_virthost_addr (const char *hostname, short int *port);
extern time_t restart_time;
--- 700,705 ----
void chdir_file(const char *file);
char *get_local_host(pool *);
! unsigned long get_virthost_addr (const char *hostname, unsigned short
*port);
extern time_t restart_time;
1.21 +3 -3 apache/src/mod_imap.c
Index: mod_imap.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_imap.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -C3 -r1.20 -r1.21
*** mod_imap.c 1997/04/06 07:43:41 1.20
--- mod_imap.c 1997/04/12 04:24:58 1.21
***************
*** 367,373 ****
char my_base[SMALLBUF] = {'\0'};
if ( ! strcasecmp(value, "map" ) || ! strcasecmp(value, "menu") ) {
! if (r->server->port == 80 ) {
ap_snprintf(url, SMALLBUF,
"http://%s%s", r->server->server_hostname, r->uri);
}
--- 367,373 ----
char my_base[SMALLBUF] = {'\0'};
if ( ! strcasecmp(value, "map" ) || ! strcasecmp(value, "menu") ) {
! if (r->server->port == DEFAULT_PORT ) {
ap_snprintf(url, SMALLBUF,
"http://%s%s", r->server->server_hostname, r->uri);
}
***************
*** 411,420 ****
url[SMALLBUF-1] = '\0';
}
else {
! if (r->server->port == 80 ) {
ap_snprintf(url, SMALLBUF, "http://%s/", r->server->server_hostname);
}
! if (r->server->port != 80 ) {
ap_snprintf(url, SMALLBUF, "http://%s:%d/",
r->server->server_hostname, r->server->port);
} /* no base, no value: pick a simple default */
--- 411,420 ----
url[SMALLBUF-1] = '\0';
}
else {
! if (r->server->port == DEFAULT_PORT ) {
ap_snprintf(url, SMALLBUF, "http://%s/", r->server->server_hostname);
}
! if (r->server->port != DEFAULT_PORT ) {
ap_snprintf(url, SMALLBUF, "http://%s:%d/",
r->server->server_hostname, r->server->port);
} /* no base, no value: pick a simple default */
1.16 +1 -1 apache/src/mod_info.c
Index: mod_info.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_info.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C3 -r1.15 -r1.16
*** mod_info.c 1997/04/06 07:43:42 1.15
--- mod_info.c 1997/04/12 04:24:59 1.16
***************
*** 312,318 ****
rputs(buf,r);
ap_snprintf(buf, sizeof(buf),
"<strong>User/Group:</strong>
<tt>%s(%d)/%d</tt><br>\n",user_name,(int)user_id,(int)group_id);
rputs(buf,r);
! ap_snprintf(buf, sizeof(buf),
"<strong>Hostname/port:</strong>
<tt>%s:%d</tt><br>\n",serv->server_hostname,serv->port);
rputs(buf,r);
ap_snprintf(buf, sizeof(buf),
"<strong>Daemons:</strong> <tt>start: %d min idle: %d
max idle: %d max:
%d</tt><br>\n",daemons_to_start,daemons_min_free,daemons_max_free,daemons_limit);
rputs(buf,r);
--- 312,318 ----
rputs(buf,r);
ap_snprintf(buf, sizeof(buf),
"<strong>User/Group:</strong>
<tt>%s(%d)/%d</tt><br>\n",user_name,(int)user_id,(int)group_id);
rputs(buf,r);
! ap_snprintf(buf, sizeof(buf),
"<strong>Hostname/port:</strong>
<tt>%s:%u</tt><br>\n",serv->server_hostname,serv->port);
rputs(buf,r);
ap_snprintf(buf, sizeof(buf),
"<strong>Daemons:</strong> <tt>start: %d min idle: %d
max idle: %d max:
%d</tt><br>\n",daemons_to_start,daemons_min_free,daemons_max_free,daemons_limit);
rputs(buf,r);
1.27 +1 -1 apache/src/mod_log_config.c
Index: mod_log_config.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_log_config.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -C3 -r1.26 -r1.27
*** mod_log_config.c 1997/03/22 23:51:02 1.26
--- mod_log_config.c 1997/04/12 04:24:59 1.27
***************
*** 330,336 ****
char *log_server_port (request_rec *r, char *a) {
char portnum[22];
! ap_snprintf(portnum, sizeof(portnum), "%d", r->server->port);
return pstrdup(r->pool, portnum);
}
--- 330,336 ----
char *log_server_port (request_rec *r, char *a) {
char portnum[22];
! ap_snprintf(portnum, sizeof(portnum), "%u", r->server->port);
return pstrdup(r->pool, portnum);
}
1.52 +4 -4 apache/src/util.c
Index: util.c
===================================================================
RCS file: /export/home/cvs/apache/src/util.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -C3 -r1.51 -r1.52
*** util.c 1997/03/22 23:51:04 1.51
--- util.c 1997/04/12 04:24:59 1.52
***************
*** 782,795 ****
else return OK;
}
! char *construct_server(pool *p, const char *hostname, int port) {
char portnum[22];
/* Long enough, even if port > 16 bits for some reason */
! if (port == 80)
return (char *)hostname;
else {
! ap_snprintf (portnum, sizeof(portnum), "%d", port);
return pstrcat (p, hostname, ":", portnum, NULL);
}
}
--- 782,795 ----
else return OK;
}
! char *construct_server(pool *p, const char *hostname, unsigned port) {
char portnum[22];
/* Long enough, even if port > 16 bits for some reason */
! if (port == DEFAULT_PORT)
return (char *)hostname;
else {
! ap_snprintf (portnum, sizeof(portnum), "%u", port);
return pstrcat (p, hostname, ":", portnum, NULL);
}
}
***************
*** 1142,1148 ****
* Parses a host of the form <address>[:port]
* :port is permitted if 'port' is not NULL
*/
! unsigned long get_virthost_addr (const char *w, short int *ports) {
struct hostent *hep;
unsigned long my_addr;
char *p;
--- 1142,1148 ----
* Parses a host of the form <address>[:port]
* :port is permitted if 'port' is not NULL
*/
! unsigned long get_virthost_addr (const char *w, unsigned short *ports) {
struct hostent *hep;
unsigned long my_addr;
char *p;
1.48 +1 -1 apache/src/util_script.c
Index: util_script.c
===================================================================
RCS file: /export/home/cvs/apache/src/util_script.c,v
retrieving revision 1.47
retrieving revision 1.48
diff -C3 -r1.47 -r1.48
*** util_script.c 1997/03/18 09:46:27 1.47
--- util_script.c 1997/04/12 04:25:00 1.48
***************
*** 176,182 ****
table_set (e, http2env (r->pool, hdrs[i].key), hdrs[i].val);
}
! ap_snprintf(port, sizeof(port), "%d", s->port);
if(!(env_path = getenv("PATH")))
env_path=DEFAULT_PATH;
--- 176,182 ----
table_set (e, http2env (r->pool, hdrs[i].key), hdrs[i].val);
}
! ap_snprintf(port, sizeof(port), "%u", s->port);
if(!(env_path = getenv("PATH")))
env_path=DEFAULT_PATH;