/* Web Polygraph http://www.web-polygraph.org/
* (C) 2003-2006 The Measurement Factory
* Licensed under the Apache License, Version 2.0 */
#ifndef POLYGRAPH__SERVER_SRVXACT_H
#define POLYGRAPH__SERVER_SRVXACT_H
#include "xstd/AlarmClock.h"
#include "base/ObjTimes.h"
#include "runtime/Xaction.h"
#include "runtime/httpHdrs.h"
class Server;
class CltGroupRep;
class ContentCfg;
class BodyIter;
class WrBuf;
class ObjWorld;
class SrvXact: public Xaction, public AlarmUser {
public:
SrvXact() { SrvXact::reset(); }
virtual void reset();
void exec(Server *anOwner, Connection *aConn, Time delay);
virtual void noteReadReady(int fd);
virtual void noteWriteReady(int fd);
virtual void wakeUp(const Alarm &a);
protected:
virtual Agent *owner();
void makeRep(WrBuf &buf);
void make406NotAcceptable(ostream &os);
bool shouldMake302Found() const;
bool canMake302Found(ObjId &oid) const;
bool make302Found(ostream &os);
bool shouldMake304NotMod() const;
void make304NotMod(ostream &os);
void make200OK(ostream &os);
void doStart();
void noteDataReady();
void grokForeignUrl(const String &url, bool &ignoreUrls);
Error interpretHeader();
bool cfgAbortedReq() const;
Error checkUri();
void consume(Size);
void overwriteUrl();
Error setViserv(const NetAddr &name);
void updatePubWorld(const ObjWorld &newSlice);
void putRemWorld(ostream &os, const ObjWorld &oldSlice) const;
void putResponseLine(ostream &os, const String &suffix);
void put200OkHead(ostream &os);
void putStdFields(ostream &os) const;
void putXFields(ostream &os) const;
void putChecksum(ostream &os);
void putCookies(ostream &os);
virtual Error setTarget(const NetAddr &target);
virtual void finish(Error err);
virtual void logStats(OLog &ol) const;
protected:
Server *theOwner;
CltGroupRep *theCltGroupRep;
ContentCfg *theContentCfg;
BodyIter *theBodyIter;
ReqHdr theReqHdr;
HttpVersion theHttpVersion;
ObjTimes theTimes; // mod, lmt, and such
Size theRepHdrSize;
Size theProducedSize;
private:
Size theConsumedSize;
};
#endif
syntax highlighted by Code2HTML, v. 0.9.1