Exemple #1
0
int MaHost::addHandler(char *name, char *extensions)
{
	MaHandlerService	*hs;

	hs = server->http->lookupHandlerService(name);
	if (hs == 0) {
		mprError(MPR_L, MPR_LOG, "Can't find handler %s", name); 
		return MPR_ERR_NOT_FOUND;
	}
	if (extensions == 0 || *extensions == '\0') {
		mprLog(MPR_CONFIG, "Add %s\n", name);
		insertHandler(hs->newHandler(server, this, 0));

	} else {
		mprLog(MPR_CONFIG, "Add %s for \"%s\"\n", name, extensions);
		insertHandler(hs->newHandler(server, this, extensions));
	}
	flags |= MPR_HTTP_ADD_HANDLER;
	return 0;
}
Exemple #2
0
void MaHost::inheritHost(MaHost *host)
{
	MaHandler			*hp;
	MaHandlerService	*hs;
	MaLocation			*lp;
	MaDir				*dp;
	MaAlias				*ap;

	//
	//	Inherit key settings
	//
	httpVersion = host->httpVersion;
#if BLD_FEATURE_KEEP_ALIVE
	keepAlive = host->keepAlive;
	keepAliveTimeout = host->keepAliveTimeout;
	maxKeepAlive = host->maxKeepAlive;
#endif
	timeout = host->timeout;
#if BLD_FEATURE_SESSION
	sessionTimeout = host->sessionTimeout;
#endif
#if BLD_FEATURE_ACCESS_LOG
	logHost = host->logHost;
#endif
	setMimeTypes(host->mimeTypes);

	//
	//	Inherit Aliases
	//
	ap = (MaAlias*) host->aliases.getFirst();
	while (ap) {
		insertAlias(new MaAlias(ap));
		ap = (MaAlias*) host->aliases.getNext(ap);
	}

	//
	//	Inherit Directories
	//
	dp = (MaDir*) host->dirs.getFirst();
	while (dp) {
		insertDir(new MaDir(this, dp));
		dp = (MaDir*) host->dirs.getNext(dp);
	}

	//
	//	Inherit Handlers
	//
	hp = (MaHandler*) host->handlers.getFirst();
	while (hp) {
		hs = server->http->lookupHandlerService(hp->getName());
		insertHandler(hs->newHandler(host->getServer(), this, 
			hp->getExtensions()));
		hp = (MaHandler*) host->handlers.getNext(hp);
	}

	//
	//	Inherit Locations
	//
	lp = (MaLocation*) host->locations.getFirst();
	while (lp) {
		insertLocation(new MaLocation(lp));
		lp = (MaLocation*) host->locations.getNext(lp);
	}
}
 // ----------------------------
 // VolumeFile_IO::insertHandler
 // ----------------------------
 // Purpose:
 //   Convenence function for adding objects to the map.
 // ---- Change History ----
 // 11/13/2009 -- Joe R. -- Initially implemented.
 // 11/20/2009 -- Joe R. -- Removed extension arg.  Now using what the object provides.
 void VolumeFile_IO::insertHandler(const Ptr& vfio)
 {
   insertHandler(handlerMap(),vfio);
 }