Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #47172

Re: Errin when executing a cgi script that sets a cookie in the browser

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 <cameron@cskk.homeip.net>
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 <cs@zip.com.au>
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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2779.1370482916.3114.python-list@python.org> (permalink)
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

Show key headers only | View raw


On 05Jun2013 14:18, rurpy@yahoo.com <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,  <rurpy@yahoo.com> 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 <cs@zip.com.au>

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.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Errin when executing a cgi script that sets a cookie in the browser Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2013-06-05 12:54 -0700
  Re: Errin when executing a cgi script that sets a cookie in the browser John Gordon <gordon@panix.com> - 2013-06-05 20:13 +0000
  Re: Errin when executing a cgi script that sets a cookie in the browser Chris Angelico <rosuav@gmail.com> - 2013-06-06 06:14 +1000
  Re: Errin when executing a cgi script that sets a cookie in the browser rurpy@yahoo.com - 2013-06-05 13:56 -0700
    Re: Errin when executing a cgi script that sets a cookie in the browser Chris Angelico <rosuav@gmail.com> - 2013-06-06 07:03 +1000
      Re: Errin when executing a cgi script that sets a cookie in the browser rurpy@yahoo.com - 2013-06-05 14:18 -0700
        Re: Errin when executing a cgi script that sets a cookie in the browser Chris Angelico <rosuav@gmail.com> - 2013-06-06 08:21 +1000
          Re: Errin when executing a cgi script that sets a cookie in the browser rurpy@yahoo.com - 2013-06-05 15:36 -0700
            Re: Errin when executing a cgi script that sets a cookie in the browser Chris Angelico <rosuav@gmail.com> - 2013-06-06 11:37 +1000
          Re: Errin when executing a cgi script that sets a cookie in the browser Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2013-06-05 20:27 -0700
            Re: Errin when executing a cgi script that sets a cookie in the browser Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2013-06-05 23:25 -0700
        Re: Errin when executing a cgi script that sets a cookie in the browser Cameron Simpson <cs@zip.com.au> - 2013-06-06 10:32 +1000
        Re: Errin when executing a cgi script that sets a cookie in the browser Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2013-06-05 20:23 -0700
          Re: Errin when executing a cgi script that sets a cookie in the browser Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2013-06-06 03:53 -0700
            Re: Errin when executing a cgi script that sets a cookie in the browser rurpy@yahoo.com - 2013-06-06 11:40 -0700
              Re: Errin when executing a cgi script that sets a cookie in the browser Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2013-06-06 12:01 -0700
                Re: Errin when executing a cgi script that sets a cookie in the browser Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2013-06-06 12:08 -0700
            Re: Errin when executing a cgi script that sets a cookie in the browser Lele Gaifax <lele@metapensiero.it> - 2013-06-06 21:26 +0200
              Re: Errin when executing a cgi script that sets a cookie in the browser Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2013-06-06 12:30 -0700
            Re: Errin when executing a cgi script that sets a cookie in the browser Skip Montanaro <skip@pobox.com> - 2013-06-06 14:35 -0500
              Re: Errin when executing a cgi script that sets a cookie in the browser Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2013-06-06 13:07 -0700
            Re: Errin when executing a cgi script that sets a cookie in the browser Lele Gaifax <lele@metapensiero.it> - 2013-06-06 22:28 +0200
              Re: Errin when executing a cgi script that sets a cookie in the browser Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2013-06-07 00:20 -0700
                Re: Errin when executing a cgi script that sets a cookie in the browser Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2013-06-07 00:51 -0700
                Re: Errin when executing a cgi script that sets a cookie in the browser MRAB <python@mrabarnett.plus.com> - 2013-06-07 15:32 +0100
                Re: Errin when executing a cgi script that sets a cookie in the browser Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2013-06-07 11:24 -0700
                Re: Errin when executing a cgi script that sets a cookie in the browser MRAB <python@mrabarnett.plus.com> - 2013-06-07 21:47 +0100
                Re: Errin when executing a cgi script that sets a cookie in the browser Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2013-06-07 23:53 -0700
                Re: Errin when executing a cgi script that sets a cookie in the browser Chris Angelico <rosuav@gmail.com> - 2013-06-08 17:01 +1000
                Re: Errin when executing a cgi script that sets a cookie in the browser Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2013-06-08 08:36 -0700
                Re: Errin when executing a cgi script that sets a cookie in the browser Chris Angelico <rosuav@gmail.com> - 2013-06-09 02:03 +1000
                Re: Errin when executing a cgi script that sets a cookie in the browser Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2013-06-08 09:56 -0700
                Re: Errin when executing a cgi script that sets a cookie in the browser Michael Torrie <torriem@gmail.com> - 2013-06-08 15:17 -0600
                Re: Errin when executing a cgi script that sets a cookie in the browser Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2013-06-08 14:33 -0700
                Re: Errin when executing a cgi script that sets a cookie in the browser nagia.retsina@gmail.com - 2013-06-08 22:27 -0700
                Re: Errin when executing a cgi script that sets a cookie in the browser Νικόλαος Κούρας <nikos.gr33k@gmail.com> - 2013-06-09 03:42 -0700
                Re: Errin when executing a cgi script that sets a cookie in the browser Chris Angelico <rosuav@gmail.com> - 2013-06-09 08:21 +1000

csiph-web