summaryrefslogtreecommitdiff
path: root/lisp/net
diff options
context:
space:
mode:
authorDaiki Ueno <ueno@unixuser.org>2009-11-27 07:35:14 +0000
committerDaiki Ueno <ueno@unixuser.org>2009-11-27 07:35:14 +0000
commit6c6f788d8a5e09e2c3ffa2d5f7cfad6898825fd7 (patch)
tree1d77dad0faa533269e7a609ac05a105808b6f953 /lisp/net
parent6f06a17190784b62e45686ce3efd17e838ec1cb6 (diff)
downloademacs-6c6f788d8a5e09e2c3ffa2d5f7cfad6898825fd7.tar.gz
(socks-send-command): Convert binary request to
unibyte before sending. This fixes mishandling of some port numbers such as 129.
Diffstat (limited to 'lisp/net')
-rw-r--r--lisp/net/socks.el42
1 files changed, 22 insertions, 20 deletions
diff --git a/lisp/net/socks.el b/lisp/net/socks.el
index 0b13996e84f..b1c045e3bc0 100644
--- a/lisp/net/socks.el
+++ b/lisp/net/socks.el
@@ -435,27 +435,29 @@ version.")
(error "Unsupported address type for HTTP: %d" atype)))
port)))
((equal version 4)
- (setq request (format
- "%c%c%c%c%s%s%c"
- version ; version
- command ; command
- (lsh port -8) ; port, high byte
- (- port (lsh (lsh port -8) 8)) ; port, low byte
- addr ; address
- (user-full-name) ; username
- 0 ; terminate username
- )))
+ (setq request (string-make-unibyte
+ (format
+ "%c%c%c%c%s%s%c"
+ version ; version
+ command ; command
+ (lsh port -8) ; port, high byte
+ (- port (lsh (lsh port -8) 8)) ; port, low byte
+ addr ; address
+ (user-full-name) ; username
+ 0 ; terminate username
+ ))))
((equal version 5)
- (setq request (format
- "%c%c%c%c%s%c%c"
- version ; version
- command ; command
- 0 ; reserved
- atype ; address type
- addr ; address
- (lsh port -8) ; port, high byte
- (- port (lsh (lsh port -8) 8)) ; port, low byte
- )))
+ (setq request (string-make-unibyte
+ (format
+ "%c%c%c%c%s%c%c"
+ version ; version
+ command ; command
+ 0 ; reserved
+ atype ; address type
+ addr ; address
+ (lsh port -8) ; port, high byte
+ (- port (lsh (lsh port -8) 8)) ; port, low byte
+ ))))
(t
(error "Unknown protocol version: %d" version)))
(process-send-string proc request)