From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kenichi Handa Newsgroups: gmane.emacs.devel Subject: Re: encoding and content-length for url-http.el Date: Sat, 11 Jun 2005 20:06:07 +0900 Message-ID: References: <1118418076.8854.41.camel@localhost.localdomain> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 (generated by SEMI 1.14.3 - "Ushinoya") Content-Type: text/plain; charset=US-ASCII X-Trace: sea.gmane.org 1118489115 1841 80.91.229.2 (11 Jun 2005 11:25:15 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 11 Jun 2005 11:25:15 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jun 11 13:25:06 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Dh46m-0001lR-Fr for ged-emacs-devel@m.gmane.org; Sat, 11 Jun 2005 13:25:00 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dh4B9-0001AA-7Y for ged-emacs-devel@m.gmane.org; Sat, 11 Jun 2005 07:29:31 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Dh43E-0006xs-3W for emacs-devel@gnu.org; Sat, 11 Jun 2005 07:21:20 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Dh43A-0006vi-Ju for emacs-devel@gnu.org; Sat, 11 Jun 2005 07:21:18 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Dh439-0006ZZ-W3 for emacs-devel@gnu.org; Sat, 11 Jun 2005 07:21:16 -0400 Original-Received: from [192.47.44.130] (helo=tsukuba.m17n.org) by monty-python.gnu.org with esmtp (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.34) id 1Dh3pr-0003PP-0v for emacs-devel@gnu.org; Sat, 11 Jun 2005 07:07:31 -0400 Original-Received: from nfs.m17n.org (nfs.m17n.org [192.47.44.7]) by tsukuba.m17n.org (8.12.3/8.12.3/Debian-7.1) with ESMTP id j5BB6986021779; Sat, 11 Jun 2005 20:06:09 +0900 Original-Received: from etlken (etlken.m17n.org [192.47.44.125]) by nfs.m17n.org (8.12.3/8.12.3/Debian-7.1) with ESMTP id j5BB69Cq025196; Sat, 11 Jun 2005 20:06:09 +0900 Original-Received: from handa by etlken with local (Exim 3.36 #1 (Debian)) id 1Dh3oV-00046m-00; Sat, 11 Jun 2005 20:06:07 +0900 Original-To: "Mark A. Hershberger" In-reply-to: <1118418076.8854.41.camel@localhost.localdomain> (mah@everybody.org) User-Agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/22.0.50 (i686-pc-linux-gnu) MULE/5.0 (SAKAKI) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:38569 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:38569 In article <1118418076.8854.41.camel@localhost.localdomain>, "Mark A. Hershberger" writes: > Could I get input on the following patch before I apply it? The first > part (using string-bytes instead of length) seems like a no-brainer. > The second part, I'm less sure about. If url-request-data is a string of raw bytes (i.e. not-yet decoded, or already-encoded), you had better use length because it works both for multibyte-string and unibyte-string. Otherwise, you must at first encode it and check the resulting length to decide the value for "Content-Length:", and calling detect-coding-string on url-request-data is nonsense. --- Kenichi Handa handa@m17n.org > --- url-http.el 4 Jun 2005 18:37:16 -0000 1.14 > +++ url-http.el 10 Jun 2005 18:36:06 -0000 > @@ -259,7 +259,7 @@ > (if url-request-data > (concat > "Content-length: " (number-to-string > - (length url-request-data)) > + (string-bytes url-request-data)) > "\r\n")) > ;; End request > "\r\n" > @@ -1066,6 +1066,9 @@ > (set-process-buffer connection buffer) > (set-process-sentinel connection 'url-http-end-of-document-sentinel) > (set-process-filter connection 'url-http-generic-filter) > + (set-process-coding-system connection > + (detect-coding-string url-request-data t) > + url-request-coding-system) > (process-send-string connection (url-http-create-request url)))) > buffer)) > -- > http://mah.everybody.org/weblog/ > GPG Fingerprint: 7E15 362D A32C DFAB E4D2 B37A 735E F10A 2DFC BFF5 > More people are killed every year by pigs than by sharks, which shows > you how good we are at evaluating risk. -- Bruce Schneier > [1.2 This is a digitally signed message part ] > [2 ] > _______________________________________________ > Emacs-devel mailing list > Emacs-devel@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-devel