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


Groups > comp.lang.python > #47151

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

References <400ea041-adcf-4640-8872-f81808f7d402@googlegroups.com> <386bdf4a-53ae-4312-af5d-e28ef10ada42@googlegroups.com>
Date 2013-06-06 07:03 +1000
Subject Re: Errin when executing a cgi script that sets a cookie in the browser
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.2765.1370466218.3114.python-list@python.org> (permalink)

Show all headers | View raw


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 )
>>...
>
> If you look in the Apache error log file, you will see something like,
>
>   [Wed Jun 05 16:39:14 2013] [error] [client 192.168.0.1] malformed header from script. Bad header= \xce\x91\xce\xa0\xce\x9f \xce\x94\xce\xa9 \xce\x9a\xce\x91\xce\x99 \xce\xa3\xce\xa4\xce\x9f \xce\x95\xce: koukos.py
>
> which is saying that the 'message' text is being interpreted as
> being part of the headers.
>
> You are missing a blank line between the header lines and the
> page text.  That is, I think you want,
>
>   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. Nikos,
do you know what effect that will have? If not, research HTTP. RFC
2616 is a good place to start.

ChrisA

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