From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nala Ginrut Newsgroups: gmane.lisp.guile.devel Subject: Re: Comments on the web modules Date: Tue, 03 Jun 2014 15:58:02 +0800 Organization: HFG Message-ID: <1401782282.30925.59.camel@Renee-desktop.suse> References: <87lhtgc1zn.fsf@primfilat.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1401782321 11172 80.91.229.3 (3 Jun 2014 07:58:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 3 Jun 2014 07:58:41 +0000 (UTC) Cc: guile-devel@gnu.org To: Josep Portella Florit Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Jun 03 09:58:33 2014 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Wrjc7-0000gZ-Sm for guile-devel@m.gmane.org; Tue, 03 Jun 2014 09:58:32 +0200 Original-Received: from localhost ([::1]:50829 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wrjc7-0005gj-Hv for guile-devel@m.gmane.org; Tue, 03 Jun 2014 03:58:31 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60197) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wrjbv-0005g0-B2 for guile-devel@gnu.org; Tue, 03 Jun 2014 03:58:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wrjbm-0001pv-9M for guile-devel@gnu.org; Tue, 03 Jun 2014 03:58:19 -0400 Original-Received: from mail-pd0-x232.google.com ([2607:f8b0:400e:c02::232]:58981) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wrjbm-0001pj-2M for guile-devel@gnu.org; Tue, 03 Jun 2014 03:58:10 -0400 Original-Received: by mail-pd0-f178.google.com with SMTP id v10so4360300pde.37 for ; Tue, 03 Jun 2014 00:58:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:subject:from:to:cc:date:in-reply-to:references :organization:content-type:mime-version:content-transfer-encoding; bh=gbHiyQLVDVS4QJyuBx1z3pG9Jl+jj2P+EYzX85H7SKw=; b=DxADRZ2OUoCi0uB3ojpcSms6fSDNo5qN7L8L+yD/oCm1ptIiliL2cdXFNmgPGZSVMg wF0Z6eIkLhlJxbx4BlszOqRT28LqDJFdwjtCpfnqCf/L18xeHnah9wvJTy4ij8lVQtWG 5I/upl0P/eKHnrnRmtOb+0Obt5Y6pnzAwpzeFKzlZQxZJP3CZolTzNP8fUQZxNflwZa4 BphIlabRtS9mdusz8iapP5Y8yeyxxmFbJoGbwtfVKDN5EL9VnAls5PVTuY9v6xUjg7qQ Xs5isCp1Q9GuxI3ItF8GINyNZGJoMCFZq/meLzvXNeyW6+/3SRMsUiYKu+/XiRATjFKr eQow== X-Received: by 10.68.110.65 with SMTP id hy1mr47121572pbb.67.1401782288692; Tue, 03 Jun 2014 00:58:08 -0700 (PDT) Original-Received: from [147.2.147.115] ([203.192.156.9]) by mx.google.com with ESMTPSA id gz11sm24632482pbd.1.2014.06.03.00.58.05 for (version=SSLv3 cipher=RC4-SHA bits=128/128); Tue, 03 Jun 2014 00:58:07 -0700 (PDT) In-Reply-To: <87lhtgc1zn.fsf@primfilat.com> X-Mailer: Evolution 3.4.4 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400e:c02::232 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:17183 Archived-At: Hi Josep! On Sun, 2014-06-01 at 13:18 +0200, Josep Portella Florit wrote: > Hi! > > I have some comments on the web modules: > > 1) The web server handlers receive a request object and the body as a > bytevector. I think it would be more flexible to pass the request > object only, and let the handler decide how to read the body from the > port of the request object; it would allow processing large bodies > without being bound by RAM. I agree with you. The users can't handle the http body by themselves. For an instance, you have no chance to limit the size of uploaded file, since the http-read has read all the body bytevectors in the RAM already. And request-handler in run-server expects http body as the argument. One of the solution is to add an option to http-read, and return body as a port when we don't want run-server to read body for us. (Note that #f couldn't be the proper placeholder since it means 'no body'). [...] > 3) The web server should add the client's sock-addr to the meta alist > of the request object. I know you planned to do this, according to > the `request-meta' documentation and the (web server http) source. > Instead of taking the `cdr' of `accept's return value and storing it > somewhere, which would complicate the code, you could use > `getpeername' when building the request. I'm interested in this > because I wrote a procedure that creates request objects from CGI > requests, and I would like to make the meta information compatible. > I need sock-addr too. Besides, I expect there's a way to let user defined server-handler take the request handler too. One of the cases we need it is to support websocket. Once the websocket handshake is done, users may handle the socket data with client's sock-addr. And the inner-server don't serve the socket with HTTP protocol at all. My request could be hard to compatible with our current server module. If it's too hard to be in guile-core, I have to write a new server in my web-framework for full websocket support. Best regards.