From 6c6f788d8a5e09e2c3ffa2d5f7cfad6898825fd7 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Fri, 27 Nov 2009 07:35:14 +0000 Subject: (socks-send-command): Convert binary request to unibyte before sending. This fixes mishandling of some port numbers such as 129. --- lisp/ChangeLog | 6 ++++++ lisp/net/socks.el | 42 ++++++++++++++++++++++-------------------- 2 files changed, 28 insertions(+), 20 deletions(-) (limited to 'lisp') diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ef98cf4e5c0..7227f11add3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2009-11-27 Daiki Ueno + + * net/socks.el (socks-send-command): Convert binary request to + unibyte before sending. This fixes mishandling of some port + numbers such as 129. + 2009-11-27 Stefan Monnier * help.el (describe-bindings-internal): Remove `interactive'. 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) -- cgit v1.2.1