mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-23 20:03:31 +01:00
proxies send port in host order as ascii string
svn:r83
This commit is contained in:
parent
b8b8ab2fd6
commit
39423023af
@ -8,8 +8,11 @@
|
|||||||
/*
|
/*
|
||||||
* Changes :
|
* Changes :
|
||||||
* $Log$
|
* $Log$
|
||||||
* Revision 1.1 2002/06/26 22:45:50 arma
|
* Revision 1.2 2002/08/24 07:56:22 arma
|
||||||
* Initial revision
|
* 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
|
||||||
*
|
*
|
||||||
* Revision 1.2 2002/04/02 14:27:33 badbytes
|
* Revision 1.2 2002/04/02 14:27:33 badbytes
|
||||||
* Final finishes.
|
* Final finishes.
|
||||||
@ -144,6 +147,10 @@ int http_get_dest(unsigned char *rl, unsigned char **addr, unsigned char **port)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* check for a :port in the address */
|
/* 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,':');
|
colon = strchr(start,':');
|
||||||
if (colon)
|
if (colon)
|
||||||
{
|
{
|
||||||
|
@ -8,6 +8,9 @@
|
|||||||
/*
|
/*
|
||||||
* Changes :
|
* Changes :
|
||||||
* $Log$
|
* $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
|
* Revision 1.5 2002/07/20 02:01:18 arma
|
||||||
* bugfixes: don't hang waiting for new children to die; accept HTTP/1.1
|
* bugfixes: don't hang waiting for new children to die; accept HTTP/1.1
|
||||||
*
|
*
|
||||||
@ -207,14 +210,14 @@ int handle_connection(int new_sock, struct hostent *local, struct sockaddr_in re
|
|||||||
write_tout(new_sock, HTTPAP_STATUS_LINE_UNEXPECTED, strlen(HTTPAP_STATUS_LINE_UNEXPECTED), conn_toutp);
|
write_tout(new_sock, HTTPAP_STATUS_LINE_UNEXPECTED, strlen(HTTPAP_STATUS_LINE_UNEXPECTED), conn_toutp);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
snprintf(port,6,"%u",htons(HTTPAP_DEFAULT_HTTP_PORT));
|
snprintf(port,6,"%u",HTTPAP_DEFAULT_HTTP_PORT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
log(LOG_DEBUG,"handle_connection() : Destination address is %s.",addr);
|
log(LOG_DEBUG,"handle_connection() : Destination address is %s.",addr);
|
||||||
log(LOG_DEBUG,"handle_connection() : Destination port is %s.",port);
|
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);
|
portn = (uint16_t)strtoul(port,&errtest,0);
|
||||||
if ((*port == '\0') || (*errtest != '\0')) /* port conversion was unsuccessful */
|
if ((*port == '\0') || (*errtest != '\0')) /* port conversion was unsuccessful */
|
||||||
{
|
{
|
||||||
@ -233,7 +236,7 @@ int handle_connection(int new_sock, struct hostent *local, struct sockaddr_in re
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(port,6,"%u",htons(portn));
|
snprintf(port,6,"%u",portn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create a standard structure */
|
/* create a standard structure */
|
||||||
@ -655,7 +658,7 @@ int main(int argc, char *argv[])
|
|||||||
/* set up the sockaddr_in structure */
|
/* set up the sockaddr_in structure */
|
||||||
local.sin_family=AF_INET;
|
local.sin_family=AF_INET;
|
||||||
local.sin_addr.s_addr = INADDR_ANY;
|
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));
|
setsockopt(request_sock, SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one));
|
||||||
|
|
||||||
|
@ -8,6 +8,9 @@
|
|||||||
/*
|
/*
|
||||||
* Changes :
|
* Changes :
|
||||||
* $Log$
|
* $Log$
|
||||||
|
* Revision 1.3 2002/08/24 07:56:34 arma
|
||||||
|
* proxies send port in host order as ascii string
|
||||||
|
*
|
||||||
* Revision 1.2 2002/07/12 18:14:17 montrose
|
* Revision 1.2 2002/07/12 18:14:17 montrose
|
||||||
* removed loglevel from global namespace. severity level is set using log() with a NULL format argument now. example: log(LOG_ERR,NULL);
|
* removed loglevel from global namespace. severity level is set using log() with a NULL format argument now. example: log(LOG_ERR,NULL);
|
||||||
*
|
*
|
||||||
@ -768,7 +771,7 @@ int handle_connection(int s, struct hostent *local, struct sockaddr_in remote, u
|
|||||||
else /* connection established, now send the standard structure + address and wait for a response */
|
else /* connection established, now send the standard structure + address and wait for a response */
|
||||||
{
|
{
|
||||||
/* write the message to the op_out buffer */
|
/* write the message to the op_out buffer */
|
||||||
snprintf(dest_port_str,6,"%u",htons(SMTPAP_DEFAULT_SMTP_PORT));
|
snprintf(dest_port_str,6,"%u",SMTPAP_DEFAULT_SMTP_PORT);
|
||||||
|
|
||||||
if (op_out != NULL)
|
if (op_out != NULL)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user