Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'wednesday,': 0.07; 'newline': 0.09; 'subject:script': 0.09; 'cc:addr:python-list': 0.11; '6:56': 0.16; 'ah,': 0.16; 'content-type': 0.16; 'cookie,': 0.16; 'dict': 0.16; 'from:addr:cs': 0.16; 'from:addr:zip.com.au': 0.16; 'from:name:cameron simpson': 0.16; 'indent': 0.16; 'list)': 0.16; 'message-id:@cskk.homeip.net': 0.16; 'newlines': 0.16; 'received:211.29': 0.16; 'received:211.29.132': 0.16; 'received:optusnet.com.au': 0.16; 'received:syd.optusnet.com.au': 0.16; 'simpson': 0.16; 'subject: \n ': 0.16; 'subject:when': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'separate': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'either.': 0.24; 'headers': 0.24; 'space.': 0.24; 'cheers,': 0.24; '(or': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'possibly': 0.26; 'right.': 0.26; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'chris': 0.29; 'am,': 0.29; 'then.': 0.30; 'subject:that': 0.31; 'quite': 0.32; 'whom': 0.33; 'subject:the': 0.34; 'something': 0.35; 'but': 0.35; 'add': 0.35; 'received:com.au': 0.36; 'two': 0.37; 'project': 0.37; 'received:211': 0.38; 'ground': 0.60; 'solve': 0.60; "you're": 0.61; 'content-disposition:inline': 0.62; "you'll": 0.62; 'act': 0.63; 'email addr:yahoo.com': 0.64; 'more': 0.64; 'body.': 0.68; 'default': 0.69; '8bit%:100': 0.72; 'to:addr:yahoo.com': 0.81; 'text/html;': 0.84; 'oil': 0.91; '2013': 0.98 Date: Thu, 6 Jun 2013 10:32:37 +1000 From: Cameron Simpson To: rurpy@yahoo.com Subject: Re: Errin when executing a cgi script that sets a cookie in the browser MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> User-Agent: Mutt/1.5.21 (2010-09-15) References: <9d8cdf1b-cc79-4266-9bf5-ce8b690ac74a@googlegroups.com> X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.0 cv=Q6eKePKa c=1 sm=1 a=wom5GMh1gUkA:10 a=whUplwpDLy0A:10 a=IkcTkHD0fZMA:10 a=vrnE16BAAAAA:8 a=ZtCCktOnAAAA:8 a=DTWuXqJYlh8A:10 a=CjxXgO3LAAAA:8 a=DB5CWCkjk8uevZLLVgYA:9 a=QEXdDO2ut3YA:10 a=rC2wZJ5BpNYA:10 a=ChdAjXE5lkUvdteQbhpnkQ==:117 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 34 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1370482916 news.xs4all.nl 15876 [2001:888:2000:d::a6]:49860 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:47172 On 05Jun2013 14:18, rurpy@yahoo.com wrote: | On Wednesday, June 5, 2013 3:03:29 PM UTC-6, Chris Angelico wrote: | > On Thu, Jun 6, 2013 at 6:56 AM, wrote: | > > On Wednesday, June 5, 2013 1:54:45 PM UTC-6, Νικόλαος Κούρας wrote: | > >>... | > >> print( cookie, "Content-type: text/html; charset=utf-8\n", message ) | > >>... | > > print( cookie, "Content-type: text/html; charset=utf-8\n\n", message ) | > > (ie, note the two \n's after the "utf-8" test.) | > | > But that won't solve it either. The default separator for print is a | > space, so this will indent his Content-type line by one space. | | Ah, quite right. Something like | | print( cookie, "\nContent-type: text/html; charset=utf-8\n\n", message ) | | then. Unless "cookie" already has a newline. Then you'll end the headers there:-) A more robust approach might be to build a dict (or possibly better, list) of headers without newlines and then as a separate act to print them with newlines and add the spacer newline later, before writing the message body. Cheers, -- Cameron Simpson Drill for oil? You mean drill into the ground to try and find oil? You're crazy. --Drillers whom Edwin L. Drake tried to enlist to his project to drill for oil in 1859.