#ifndef HTTPRESPONSE_H
#define HTTPRESPONSE_H

/*
 * @(#)HTTPResponse.h
 *
 * This file is part of webCDwriter - Network CD Writing.
 *
 * Copyright (C) 2002-2004 Jörg P. M. Haeger
 *
 * webCDwriter is free software. See CDWserver.cpp for details.
 */

#include "FileInputStream.h"
#include "String.h"

class HTTPResponse {
	int statusCode;
	String reasonPhrase;
	// Response-Header
	String location;
	// Entity Header Fields
	String contentLength;
	String contentType;
	String entityBody;
	FileInputStream entityStream;
	int entityBytesTransferred;
	String lastModified;
public:
	HTTPResponse();
	HTTPResponse(HTTPResponse *response);
	~HTTPResponse();
	int getEntityBytesTransferred() { return entityBytesTransferred; }
	int getStatusCode() { return statusCode; }
	static HTTPResponse *movedPermanently(String &location);
	static HTTPResponse *notFound();
	static HTTPResponse *notImplemented();
	void setEntity(File &file, int ifModifiedSince = 0);
	void setEntity(String &body, String &type);
	void setLocation(String &aLocation);
	void setStatusCode(int code);
	void write(class PrintWriter &writer);
	void writeHead(class PrintWriter &writer);
private:
	String *getErrorHTML();
};

#endif
