Ejemplo n.º 1
0
void KSaveIOConfig::setCacheControl(TDEIO::CacheControl policy)
{
  TDEConfig* cfg = http_config ();
  TQString tmp = TDEIO::getCacheControlString(policy);
  cfg->writeEntry("cache", tmp);
  cfg->sync();
}
Ejemplo n.º 2
0
void KSaveIOConfig::setCacheControl(KIO::CacheControl policy)
{
  KConfigGroup cfg (http_config(), QString());
  QString tmp = KIO::getCacheControlString(policy);
  cfg.writeEntry("cache", tmp);
  cfg.sync();
}
Ejemplo n.º 3
0
void KSaveIOConfig::setCacheControl(KIO::CacheControl policy)
{
  KConfig* cfg = http_config();
  QString tmp = KIO::getCacheControlString(policy);
  cfg->group("").writeEntry("cache", tmp);
  cfg->sync();
}
Ejemplo n.º 4
0
KIO::CacheControl KProtocolManager::cacheControl()
{
    KConfig *cfg = http_config();
    QString tmp = cfg->readEntry("cache");
    if(tmp.isEmpty())
        return DEFAULT_CACHE_CONTROL;
    return KIO::parseCacheControl(tmp);
}
Ejemplo n.º 5
0
int cmd_main(int argc, const char **argv)
{
	char *method = getenv("REQUEST_METHOD");
	char *dir;
	struct service_cmd *cmd = NULL;
	char *cmd_arg = NULL;
	int i;
	struct strbuf hdr = STRBUF_INIT;

	set_die_routine(die_webcgi);
	set_die_is_recursing_routine(die_webcgi_recursing);

	if (!method)
		die("No REQUEST_METHOD from server");
	if (!strcmp(method, "HEAD"))
		method = "GET";
	dir = getdir();

	for (i = 0; i < ARRAY_SIZE(services); i++) {
		struct service_cmd *c = &services[i];
		regex_t re;
		regmatch_t out[1];

		if (regcomp(&re, c->pattern, REG_EXTENDED))
			die("Bogus regex in service table: %s", c->pattern);
		if (!regexec(&re, dir, 1, out, 0)) {
			size_t n;

			if (strcmp(method, c->method))
				return bad_request(&hdr, c);

			cmd = c;
			n = out[0].rm_eo - out[0].rm_so;
			cmd_arg = xmemdupz(dir + out[0].rm_so + 1, n - 1);
			dir[out[0].rm_so] = 0;
			break;
		}
		regfree(&re);
	}

	if (!cmd)
		not_found(&hdr, "Request not supported: '%s'", dir);

	setup_path();
	if (!enter_repo(dir, 0))
		not_found(&hdr, "Not a git repository: '%s'", dir);
	git_config(git_default_config, NULL);
	if (!getenv("GIT_HTTP_EXPORT_ALL") &&
	    access("git-daemon-export-ok", F_OK) )
		not_found(&hdr, "Repository not exported: '%s'", dir);

	http_config();
	max_request_buffer = git_env_ulong("GIT_HTTP_MAX_REQUEST_BUFFER",
					   max_request_buffer);

	cmd->imp(&hdr, cmd_arg);
	return 0;
}
Ejemplo n.º 6
0
void KSaveIOConfig::setMaxCacheAge( int cache_age )
{
  KConfigGroup cfg (http_config(), QString());
  cfg.writeEntry( "MaxCacheAge", cache_age );
  cfg.sync();
}
Ejemplo n.º 7
0
void KSaveIOConfig::setUseCache( bool _mode )
{
  KConfigGroup cfg (http_config(), QString());
  cfg.writeEntry( "UseCache", _mode );
  cfg.sync();
}
Ejemplo n.º 8
0
int main(int argc, char **argv)
{
	char *method = getenv("REQUEST_METHOD");
	char *dir;
	struct service_cmd *cmd = NULL;
	char *cmd_arg = NULL;
	int i;

	git_setup_gettext();

	git_extract_argv0_path(argv[0]);
	set_die_routine(die_webcgi);

	if (!method)
		die("No REQUEST_METHOD from server");
	if (!strcmp(method, "HEAD"))
		method = "GET";
	dir = getdir();

	for (i = 0; i < ARRAY_SIZE(services); i++) {
		struct service_cmd *c = &services[i];
		regex_t re;
		regmatch_t out[1];

		if (regcomp(&re, c->pattern, REG_EXTENDED))
			die("Bogus regex in service table: %s", c->pattern);
		if (!regexec(&re, dir, 1, out, 0)) {
			size_t n;

			if (strcmp(method, c->method)) {
				const char *proto = getenv("SERVER_PROTOCOL");
				if (proto && !strcmp(proto, "HTTP/1.1")) {
					http_status(405, "Method Not Allowed");
					hdr_str("Allow", !strcmp(c->method, "GET") ?
						"GET, HEAD" : c->method);
				} else
					http_status(400, "Bad Request");
				hdr_nocache();
				end_headers();
				return 0;
			}

			cmd = c;
			n = out[0].rm_eo - out[0].rm_so;
			cmd_arg = xmemdupz(dir + out[0].rm_so + 1, n - 1);
			dir[out[0].rm_so] = 0;
			break;
		}
		regfree(&re);
	}

	if (!cmd)
		not_found("Request not supported: '%s'", dir);

	setup_path();
	if (!enter_repo(dir, 0))
		not_found("Not a git repository: '%s'", dir);
	if (!getenv("GIT_HTTP_EXPORT_ALL") &&
	    access("git-daemon-export-ok", F_OK) )
		not_found("Repository not exported: '%s'", dir);

	http_config();
	cmd->imp(cmd_arg);
	return 0;
}
Ejemplo n.º 9
0
int KProtocolManager::maxCacheSize()
{
    KConfig *cfg = http_config();
    return cfg->readNumEntry("MaxCacheSize", DEFAULT_MAX_CACHE_SIZE); // 5 MB
}
Ejemplo n.º 10
0
int KProtocolManager::maxCacheAge()
{
    KConfig *cfg = http_config();
    return cfg->readNumEntry("MaxCacheAge", DEFAULT_MAX_CACHE_AGE); // 14 days
}
Ejemplo n.º 11
0
QString KProtocolManager::cacheDir()
{
    KConfig *cfg = http_config();
    return cfg->readPathEntry("CacheDir", KGlobal::dirs()->saveLocation("cache", "http"));
}
Ejemplo n.º 12
0
bool KProtocolManager::useCache()
{
    KConfig *cfg = http_config();
    return cfg->readBoolEntry("UseCache", true);
}
Ejemplo n.º 13
0
void KSaveIOConfig::setMaxCacheAge( int cache_age )
{
  TDEConfig* cfg = http_config ();
  cfg->writeEntry( "MaxCacheAge", cache_age );
  cfg->sync();
}
Ejemplo n.º 14
0
void KSaveIOConfig::setUseCache( bool _mode )
{
  TDEConfig* cfg = http_config ();
  cfg->writeEntry( "UseCache", _mode );
  cfg->sync();
}
Ejemplo n.º 15
0
void KSaveIOConfig::setMaxCacheSize( int cache_size )
{
  KConfig* cfg = http_config();
  cfg->group("").writeEntry( "MaxCacheSize", cache_size );
  cfg->sync();
}
Ejemplo n.º 16
0
void KSaveIOConfig::setUseCache( bool _mode )
{
  KConfig* cfg = http_config();
  cfg->group("").writeEntry( "UseCache", _mode );
  cfg->sync();
}