[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[or-cvs] proxies send port in host order as ascii string
Update of /home/or/cvsroot/src/httpap
In directory moria.seul.org:/home/arma/work/onion/cvs/src/httpap
Modified Files:
http.c httpap.c
Log Message:
proxies send port in host order as ascii string
Index: http.c
===================================================================
RCS file: /home/or/cvsroot/src/httpap/http.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- http.c 26 Jun 2002 22:45:50 -0000 1.1.1.1
+++ http.c 24 Aug 2002 07:56:22 -0000 1.2
@@ -8,6 +8,9 @@
/*
* Changes :
* $Log$
+ * Revision 1.2 2002/08/24 07:56:22 arma
+ * proxies send port in host order as ascii string
+ *
* Revision 1.1.1.1 2002/06/26 22:45:50 arma
* initial commit: current code
*
@@ -144,6 +147,10 @@
return -1;
/* check for a :port in the address */
+
+/* BUG: if there's a : later in the url, eg in google's cache pages,
+ * this gets confused and fails
+ */
colon = strchr(start,':');
if (colon)
{
Index: httpap.c
===================================================================
RCS file: /home/or/cvsroot/src/httpap/httpap.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- httpap.c 20 Jul 2002 02:01:18 -0000 1.5
+++ httpap.c 24 Aug 2002 07:56:22 -0000 1.6
@@ -8,6 +8,9 @@
/*
* Changes :
* $Log$
+ * Revision 1.6 2002/08/24 07:56:22 arma
+ * proxies send port in host order as ascii string
+ *
* Revision 1.5 2002/07/20 02:01:18 arma
* bugfixes: don't hang waiting for new children to die; accept HTTP/1.1
*
@@ -207,14 +210,14 @@
write_tout(new_sock, HTTPAP_STATUS_LINE_UNEXPECTED, strlen(HTTPAP_STATUS_LINE_UNEXPECTED), conn_toutp);
return -1;
}
- snprintf(port,6,"%u",htons(HTTPAP_DEFAULT_HTTP_PORT));
+ snprintf(port,6,"%u",HTTPAP_DEFAULT_HTTP_PORT);
}
else
{
log(LOG_DEBUG,"handle_connection() : Destination address is %s.",addr);
log(LOG_DEBUG,"handle_connection() : Destination port is %s.",port);
- /* conver the port to an integer */
+ /* convert the port to an integer */
portn = (uint16_t)strtoul(port,&errtest,0);
if ((*port == '\0') || (*errtest != '\0')) /* port conversion was unsuccessful */
{
@@ -233,7 +236,7 @@
return -1;
}
- snprintf(port,6,"%u",htons(portn));
+ snprintf(port,6,"%u",portn);
}
/* create a standard structure */
@@ -655,7 +658,7 @@
/* set up the sockaddr_in structure */
local.sin_family=AF_INET;
local.sin_addr.s_addr = INADDR_ANY;
- local.sin_port=p;
+ local.sin_port=p; /* p is already in network order */
setsockopt(request_sock, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));