mirror of
https://github.com/curl/curl.git
synced 2026-08-26 08:33:31 +03:00
parent
381c3d56e3
commit
3a0c600a1e
90 changed files with 463 additions and 593 deletions
|
|
@ -424,22 +424,22 @@ create_resp(int qid, const struct sockaddr *addr, curl_socklen_t addrlen,
|
|||
uint8_t header[12] = {
|
||||
0x80, 0xea, /* ID, overwrite */
|
||||
0x81, 0x80,
|
||||
/*
|
||||
Flags: 0x8180 Standard query response, No error
|
||||
1... .... .... .... = Response: Message is a response
|
||||
.000 0... .... .... = Opcode: Standard query (0)
|
||||
.... .0.. .... .... = Authoritative: Server is not an authority for
|
||||
domain
|
||||
.... ..0. .... .... = Truncated: Message is not truncated
|
||||
.... ...1 .... .... = Recursion desired: Do query recursively
|
||||
.... .... 1... .... = Recursion available: Server can do recursive
|
||||
queries
|
||||
.... .... .0.. .... = Z: reserved (0)
|
||||
.... .... ..0. .... = Answer authenticated: Answer/authority portion
|
||||
was not authenticated by the server
|
||||
.... .... ...0 .... = Non-authenticated data: Unacceptable
|
||||
.... .... .... 0000 = Reply code: No error (0)
|
||||
*/
|
||||
/* Flags: 0x8180 Standard query response, No error
|
||||
|
||||
1... .... .... .... = Response: Message is a response
|
||||
.000 0... .... .... = Opcode: Standard query (0)
|
||||
.... .0.. .... .... = Authoritative: Server is not an authority for
|
||||
domain
|
||||
.... ..0. .... .... = Truncated: Message is not truncated
|
||||
.... ...1 .... .... = Recursion desired: Do query recursively
|
||||
.... .... 1... .... = Recursion available: Server can do recursive
|
||||
queries
|
||||
.... .... .0.. .... = Z: reserved (0)
|
||||
.... .... ..0. .... = Answer authenticated: Answer/authority portion
|
||||
was not authenticated by the server
|
||||
.... .... ...0 .... = Non-authenticated data: Unacceptable
|
||||
.... .... .... 0000 = Reply code: No error (0)
|
||||
*/
|
||||
0x0, 0x1, /* QDCOUNT a single question */
|
||||
0x0, 0x0, /* ANCOUNT number of answers */
|
||||
0x0, 0x0, /* NSCOUNT */
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ static int disconnect(FILE *dump, curl_socket_t fd)
|
|||
}
|
||||
|
||||
/*
|
||||
do
|
||||
do
|
||||
encodedByte = X MOD 128
|
||||
|
||||
X = X DIV 128
|
||||
|
|
@ -294,16 +294,13 @@ static int disconnect(FILE *dump, curl_socket_t fd)
|
|||
// if there are more data to encode, set the top bit of this byte
|
||||
|
||||
if ( X > 0 )
|
||||
|
||||
encodedByte = encodedByte OR 128
|
||||
endif
|
||||
|
||||
endif
|
||||
'output' encodedByte
|
||||
|
||||
'output' encodedByte
|
||||
|
||||
while ( X > 0 )
|
||||
|
||||
*/
|
||||
while ( X > 0 )
|
||||
*/
|
||||
|
||||
/* return number of bytes used */
|
||||
static size_t encode_length(size_t packetlen,
|
||||
|
|
@ -684,12 +681,10 @@ end:
|
|||
return CURL_SOCKET_BAD;
|
||||
}
|
||||
|
||||
/*
|
||||
sockfdp is a pointer to an established stream or CURL_SOCKET_BAD
|
||||
/* sockfdp is a pointer to an established stream or CURL_SOCKET_BAD
|
||||
|
||||
if sockfd is CURL_SOCKET_BAD, listendfd is a listening socket we must
|
||||
accept()
|
||||
*/
|
||||
if sockfd is CURL_SOCKET_BAD, listendfd is a listening socket we must
|
||||
accept() */
|
||||
static bool mqttd_incoming(curl_socket_t listenfd)
|
||||
{
|
||||
fd_set fds_read;
|
||||
|
|
|
|||
|
|
@ -911,12 +911,10 @@ static bool disc_handshake(void)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
sockfdp is a pointer to an established stream or CURL_SOCKET_BAD
|
||||
/* sockfdp is a pointer to an established stream or CURL_SOCKET_BAD
|
||||
|
||||
if sockfd is CURL_SOCKET_BAD, listendfd is a listening socket we must
|
||||
accept()
|
||||
*/
|
||||
if sockfd is CURL_SOCKET_BAD, listendfd is a listening socket we must
|
||||
accept() */
|
||||
static bool juggle(curl_socket_t *sockfdp,
|
||||
curl_socket_t listenfd,
|
||||
enum sockmode *mode)
|
||||
|
|
@ -1041,7 +1039,7 @@ static bool juggle(curl_socket_t *sockfdp,
|
|||
Commands:
|
||||
|
||||
DATA - plain pass-through data
|
||||
*/
|
||||
*/
|
||||
|
||||
if(!read_stdin(buffer, 5))
|
||||
return FALSE;
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ static void socksd_getconfig(void)
|
|||
o 0x00 NO AUTHENTICATION REQUIRED
|
||||
o 0x01 GSSAPI
|
||||
o 0x02 USERNAME/PASSWORD
|
||||
*/
|
||||
*/
|
||||
else if(!strcmp(key, "method")) {
|
||||
pval = value;
|
||||
if(!curlx_str_number(&pval, &num, 0xff)) {
|
||||
|
|
@ -366,7 +366,7 @@ static curl_socket_t sockit(curl_socket_t fd)
|
|||
+----+------+----------+------+----------+
|
||||
| 1 | 1 | 1 to 255 | 1 | 1 to 255 |
|
||||
+----+------+----------+------+----------+
|
||||
*/
|
||||
*/
|
||||
unsigned char ulen;
|
||||
unsigned char plen;
|
||||
bool login = TRUE;
|
||||
|
|
@ -438,10 +438,10 @@ static curl_socket_t sockit(curl_socket_t fd)
|
|||
return CURL_SOCKET_BAD;
|
||||
}
|
||||
/* ATYP:
|
||||
o IPv4 address: 0x01
|
||||
o domain name: 0x03
|
||||
o IPv6 address: 0x04
|
||||
*/
|
||||
o IPv4 address: 0x01
|
||||
o domain name: 0x03
|
||||
o IPv6 address: 0x04
|
||||
*/
|
||||
type = buffer[SOCKS5_ATYP];
|
||||
address = &buffer[SOCKS5_DSTADDR];
|
||||
switch(type) {
|
||||
|
|
@ -518,19 +518,18 @@ static curl_socket_t sockit(curl_socket_t fd)
|
|||
|
||||
response[SOCKS5_VERSION] = s_config.responseversion;
|
||||
|
||||
/*
|
||||
o REP Reply field:
|
||||
o 0x00 succeeded
|
||||
o 0x01 general SOCKS server failure
|
||||
o 0x02 connection not allowed by ruleset
|
||||
o 0x03 Network unreachable
|
||||
o 0x04 Host unreachable
|
||||
o 0x05 Connection refused
|
||||
o 0x06 TTL expired
|
||||
o 0x07 Command not supported
|
||||
o 0x08 Address type not supported
|
||||
o 0x09 to 0xFF unassigned
|
||||
*/
|
||||
/* o REP Reply field:
|
||||
o 0x00 succeeded
|
||||
o 0x01 general SOCKS server failure
|
||||
o 0x02 connection not allowed by ruleset
|
||||
o 0x03 Network unreachable
|
||||
o 0x04 Host unreachable
|
||||
o 0x05 Connection refused
|
||||
o 0x06 TTL expired
|
||||
o 0x07 Command not supported
|
||||
o 0x08 Address type not supported
|
||||
o 0x09 to 0xFF unassigned
|
||||
*/
|
||||
response[SOCKS5_REP] = rep;
|
||||
response[SOCKS5_RESERVED] = 0; /* must be zero */
|
||||
response[SOCKS5_ATYP] = type; /* address type */
|
||||
|
|
@ -602,12 +601,10 @@ static int tunnel(struct perclient *cp, fd_set *fds)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
sockfdp is a pointer to an established stream or CURL_SOCKET_BAD
|
||||
/* sockfdp is a pointer to an established stream or CURL_SOCKET_BAD
|
||||
|
||||
if sockfd is CURL_SOCKET_BAD, listendfd is a listening socket we must
|
||||
accept()
|
||||
*/
|
||||
if sockfd is CURL_SOCKET_BAD, listendfd is a listening socket we must
|
||||
accept() */
|
||||
static bool socksd_incoming(curl_socket_t listenfd)
|
||||
{
|
||||
fd_set fds_read;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue