head	1.1;
branch	1.1.1;
access;
symbols
	tonic_4:1.1.1.1
	tonic_3:1.1.1.1
	tonic_2:1.1.1.1
	demo:1.1.1.1.0.8
	design_report:1.1.1.1
	dec2:1.1.1.1
	oral_presentation_freeze:1.1.1.1.0.6
	DAVEG_CDP:1.1.1.1.0.4
	template_integ:1.1.1.1.0.2
	v1_1:1.1.1.1
	nov19:1.1.1.1
	course_staff:1.1.1;
locks; strict;
comment	@ * @;


1.1
date	95.11.19.05.50.04;	author hartmans;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	95.11.19.05.50.05;	author hartmans;	state Exp;
branches;
next	;


desc
@@



1.1
log
@Initial revision
@
text
@#include "ps5/normal_response.h"
#include "ps5/simple_response.h"
#include "ps5/expired_response.h"

#include <time.h>

normal_response::normal_response(bool html) {
	html_response = html;
};

void normal_response::body(ostream &o) {
	if (html_response) http_response::body(o);
	else o << "Default plain text response\n";
}

string normal_response::content_type() {
    if (html_response) return "text/html";
    else return "text/plain";
}

simple_response::simple_response(string text, bool html)
    : normal_response(html)
{
    response_text = text;
}

void simple_response::body(ostream &o) {
    o << response_text;
}

expired_response::expired_response(bool html)
    : normal_response(html) {
}

void expired_response::headers(ostream &o) {
    http_response::headers(o);
    o << "Expires: ";
    time_t t = time(0);
    string s = asctime(gmtime(&t));
    o << s << '\n'; // Browser better be flexible about accepting ctime format.
// Format we SHOULD use: Friday, 19-Nov-82 16:59:30 EST
//                   or: Thursday, 2-Mar-95 01:01:00 PDT
}
@


1.1.1.1
log
@Bring web_server code into our tree
@
text
@@
