http://www.perlmonks.org?node_id=20898

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I want to print to server the proper response headers for a page fowared like a Location: http:www.yahoo.com and an image send, like a gif. This is for a server that will parse the header itself and send the client browser.

Originally posted as a Categorized Question.

  • Comment on From server send http response header directly to client.

Replies are listed 'Best First'.
Re: From server send http response header directly to client.
by vaevictus (Pilgrim) on Aug 29, 2000 at 18:30 UTC
    A good way to figure out what you need is to telnet to your favorite server which is already sending out similar data. For example, if you can read the first 15 lines or so of it's response to a proper GET, that'll contain your header.

    telnet www.perlmonks.org 80 Trying 206.170.14.75...
    Connected to www.perlmonks.org.
    Escape character is '^]'

    GET http://www.perlmonks.org/ HTTP/1.0 // you'll need to press Enter a few times until you get a return
    anyway... just incase you want a header to just display, here's one for ya...
    HTTP/1.1 200 OK Date: Tue, 29 Aug 2000 14:00:22 GMT Server: Apache/1.3.12 (Unix) PHP/4.0.1pl2 mod_ssl/2.6.5 OpenSSL/0.9.5a Last-Modified: Mon, 24 Jul 2000 13:28:52 GMT ETag: "179c3-37ee-397c4494" Accept-Ranges: bytes Content-Length: 14318 Connection: close Content-Type: text/html

    to out put this to a client, you'd put a CR before and after the header, and start your code after the header.

Re: From server send http response header directly to client.
by Anonymous Monk on Feb 12, 2003 at 18:28 UTC
    toto

    Originally posted as a Categorized Answer.