Mailing List Archive

Support open source code!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

tlug: HTTP headers q



>>>>> "FB" == =?iso-2022-jp?B?GyRCJVUlaSVzJS8kWSVNJUMlSBsoQg==?=  <bennett@example.com> writes:

    FB> I am having trouble with HTTP headers again.

Yes.  Read RFC-822 (just for fun and a BNF review) and RFC-2045.
Wouldn't hurt to read RFC-204[6789], too, but that's asking a lot and
not directly relevant.  ;-)

    FB>     if {[lsearch -exact [cgi_cookie_list] clientid]==-1} {
    FB>       puts "Content-type: content=\"text/html\"; charset=\"EUC-JP\""

Just

	    puts "Content-Type: text/html; charset=EUC-JP"

should do nicely.  The "content =" stuff is a <META HTTP-EQUIV=...>-ism.
RFC-2045 headers don't have that.  The (escaped) quotes are
unnecessary since none of the value parts have syntactic roles.

    FB>       puts "Pragma: content=\"no-cache\""

Probably ditto, but I don't grok Pragma headers.  Very implementation
dependent in general although "no-cache" is a standard one IIRC.

    FB>       puts "Set-Cookie: clientid=$clientid"
    }

    FB> When I "fixed" things so that Content-type: and the Pragma:
    FB> both output always, and added the empty line, I got what looks
    FB> like *Apache's* Content-type: header (text/plain) as part of
    FB> the text of the document when it is rendered.  What's Apache
    FB> putting its finger into the works for?

Evidently Apache or FastCGI tries to be helpful by adding a default
header if it doesn't detect a valid one.

It's interesting that Lynx doesn't worry about it.

    FB> If anyone has read this far without their eyes glazing over
    FB> ...  any suggestions?  Including (especially) texts I should
    FB> read to better learn my way around Apache and CGI programming.

Just remember that an HTTP document is actually an RFC-2045 message for
all practical purposes and you should be OK.

Also, there are several Perl libraries and a standard Python library
for CGIs.  I don't know which are standard for Perl, but you should
consider using those, as a lot of this gook will be replaced by
setting variables.


-- 
University of Tsukuba                Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
Institute of Policy and Planning Sciences       Tel/fax: +81 (298) 53-5091
_________________  _________________  _________________  _________________
What are those straight lines for?  "XEmacs rules."
--------------------------------------------------------------------
Next Nomikai Meeting: February 18 (Fri) 19:00 Tengu TokyoEkiMae
Next Technical Meeting:  March 11 (Sat) 13:00 Temple University Japan
* Topic: TBD
--------------------------------------------------------------------
more info: http://www.tlug.gr.jp        Sponsor: Global Online Japan


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links