Re: Killing plaintext git:// in favor of https:// cloning

2016-02-26 Thread Daniel Reichelt
On 02/22/2016 07:16 PM, Jason A. Donenfeld wrote:
> Does anybody have any objections or comments?

git:// should be removed from clone urls

Cheers
Daniel
___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


Re: [PATCH] add new option atom-root

2015-08-13 Thread Daniel Reichelt
You yourself got me thinking about this (see previous archive link) :)

The problem is, we don't know how different browsers would call external feed 
reader programs
a) with the correctly assembled feed url
b) dumb as hell with just the relative part...
___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


Re: /about redirected to /about/

2015-08-13 Thread Daniel Reichelt
Hi Jason,

> Please let me know if this poses any problems.

I'm afraid, it does here:


Requesting a document works, however a request to /cgit/$repo.git/about/ gets
301'd to /cgit/$repo.git/about/ until firefox throws up.


I added some debug printing to cmd.c:about_pre():
--8<
static void about_pre(void)
{
fprintf(stderr, "cmd url is: #%s#\n", ctx.qry.url);
fprintf(stderr, "cmd qryp is: #%s#\n", ctx.qry.path);
if (ctx.repo && !ctx.qry.path && ctx.qry.url[strlen(ctx.qry.url) - 1] 
!= '/')
cgit_redirect(fmtalloc("%s/", cgit_currenturl()), true);
}
--8<


For requesting a document, say cryptsetup.md, it writes
--8<
[Thu Aug 13 10:44:25.121565 2015] [cgi:error] [pid 1192] [client ::1:60435]
AH01215: cmd url is: #wiki.git/about#
[Thu Aug 13 10:44:25.121672 2015] [cgi:error] [pid 1192] [client ::1:60435]
AH01215: cmd qryp is: #cryptsetup.md#
--8<


For requesting the document listing about/, it writes
--8<
==> /var/log/apache2/error-repositories-hacking.log <==
[Thu Aug 13 10:45:46.755487 2015] [cgi:error] [pid 7586] [client ::1:60522]
AH01215: cmd url is: #wiki.git/about#, referer: https://
[Thu Aug 13 10:45:46.755567 2015] [cgi:error] [pid 7586] [client ::1:60522]
AH01215: cmd qryp is: #(null)#, referer: https://
--8<



As you can see, there's no trailing slash at that point, even when contained in
the http request. So the check for the trailing slash in cmd.c:49 always
triggers the redirect.

Here's a trace of firefox' "Live HTTP headers" for a request to about/:

--8<
https://www./repositories/cgit/wiki.git/about/

GET /repositories/cgit/wiki.git/about/ HTTP/1.1
Host: www.*
User-Agent: Mozilla/5.0[...]
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
DNT: 1
Referer: https://www.*/repositories/cgit/wiki.git/
Connection: keep-alive

HTTP/1.1 301 Moved
Date: Thu, 13 Aug 2015 08:47:41 GMT
Server: Apache
Location: /repositories/cgit/wiki.git/about/
X-Content-Type-Options: nosniff
X-Frame-Options: sameorigin
Content-Length: 0
Keep-Alive: timeout=5, max=80
Connection: Keep-Alive
--8<


And here's the corresponding entry from apache2's access.log:
--8<
::1 - - [13/Aug/2015:10:47:41 +0200] "GET /repositories/cgit/wiki.git/about/
HTTP/1.1" 301 4611 "https://***/repositories/cgit/wiki.git/"; "Mozilla/5.0[...]"
--8<


Hauler if you need additional info.


Cheers
Daniel

___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


[PATCH] add new option atom-root

2015-08-12 Thread Daniel Reichelt
In reverse-proxy setups cgit's auto-determination of the hostname doesn't
work. When set, this option will be used as prefix to all atom-related
URLs. While the rest of cgit's URLs are not absolute, this option, if set,
should be absolute and include a scheme. Default value: none.

Signed-off-by: Daniel Reichelt 
---
 cgit.c   |  2 ++
 cgit.h   |  1 +
 cgitrc.5.txt |  6 ++
 ui-atom.c| 16 
 ui-shared.c  |  8 ++--
 5 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/cgit.c b/cgit.c
index d84b4be..351f9bd 100644
--- a/cgit.c
+++ b/cgit.c
@@ -142,6 +142,8 @@ static void config_cb(const char *name, const char *value)
ctx.cfg.strict_export = xstrdup(value);
else if (!strcmp(name, "virtual-root")) {
ctx.cfg.virtual_root = ensure_end(value, '/');
+   } else if (!strcmp(name, "atom-root")) {
+   ctx.cfg.atom_root = xstrdup(value);
} else if (!strcmp(name, "nocache"))
ctx.cfg.nocache = atoi(value);
else if (!strcmp(name, "noplainemail"))
diff --git a/cgit.h b/cgit.h
index 3120562..a3bb3aa 100644
--- a/cgit.h
+++ b/cgit.h
@@ -209,6 +209,7 @@ struct cgit_config {
char *section;
char *repository_sort;
char *virtual_root; /* Always ends with '/'. */
+   char *atom_root;
char *strict_export;
int cache_size;
int cache_dynamic_ttl;
diff --git a/cgitrc.5.txt b/cgitrc.5.txt
index 759f353..4cb5be9 100644
--- a/cgitrc.5.txt
+++ b/cgitrc.5.txt
@@ -42,6 +42,12 @@ agefile::
hh:mm:ss". You may want to generate this file from a post-receive
hook. Default value: "info/web/last-modified".
 
+atom-root::
+   In reverse-proxy setups cgit's auto-determination of the hostname 
doesn't
+   work. When set, this option will be used as prefix to all atom-related
+   URLs. While the rest of cgit's URLs are not absolute, this option, if 
set,
+   should be absolute and include a scheme. Default value: none.
+
 auth-filter::
Specifies a command that will be invoked for authenticating repository
access. Receives quite a few arguments, and data on both stdin and
diff --git a/ui-atom.c b/ui-atom.c
index e2b39ee..038a168 100644
--- a/ui-atom.c
+++ b/ui-atom.c
@@ -54,8 +54,12 @@ static void add_entry(struct commit *commit, const char 
*host)
html("\n");
if (host) {
html("\n");
if (host) {
html("\n");
}
diff --git a/ui-shared.c b/ui-shared.c
index 6be0c2e..a051cd8 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -751,8 +751,12 @@ void cgit_print_docstart(void)
strbuf_addf(&sb, "h=%s", ctx.qry.head);
 
html("\n");
-- 
2.1.4


___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


[PATCH] add new option atom-root (was: Relative URL for Atom feed announcement)

2015-08-12 Thread Daniel Reichelt
Hi folks,

quite a while back, I suggested to create the link of the atom feed as relative
URL [1]. This worked as long as only the feed titles would be viewed but as soon
as one would want to actually use the links *within* the feed, one was lost 
again.

After a little bit of thinking I came up with the patch following this mail.

Opinions?

Cheers
Daniel


[1] http://lists.zx2c4.com/pipermail/cgit/2014-January/001629.html



Daniel Reichelt (1):
  add new option atom-root

 cgit.c   |  2 ++
 cgit.h   |  1 +
 cgitrc.5.txt |  6 ++
 ui-atom.c| 16 
 ui-shared.c  |  8 ++--
 5 files changed, 27 insertions(+), 6 deletions(-)

-- 
2.1.4



___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


Re: [PATCH] Fix processing of repo.hide and repo.ignore

2015-08-10 Thread Daniel Reichelt
> Missing sign-off (see [1] for what this means).  Also please try to send
> patches inline instead of as attachments; "git format-patch" will do
> this.
> 
> The patch itself looks good to me.
> 
> [1] 
> https://github.com/git/git/blob/v2.5.0/Documentation/SubmittingPatches#L234

Thanks for the heads-up, John.

Here we go again, with sign-off tag and inline...

___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


[PATCH] Fix processing of repo.hide and repo.ignore

2015-08-10 Thread Daniel Reichelt
If the global option enable-filter-overrides is set to 1 the repo-specific
options repo.hide and repo.ignore never got processed.

Signed-off-by: Daniel Reichelt 
---
 cgit.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/cgit.c b/cgit.c
index ae413c6..8c9cfb5 100644
--- a/cgit.c
+++ b/cgit.c
@@ -82,6 +82,10 @@ static void repo_config(struct cgit_repo *repo, const char 
*name, const char *va
repo->logo = xstrdup(value);
else if (!strcmp(name, "logo-link") && value != NULL)
repo->logo_link = xstrdup(value);
+   else if (!strcmp(name, "hide"))
+   repo->hide = atoi(value);
+   else if (!strcmp(name, "ignore"))
+   repo->ignore = atoi(value);
else if (ctx.cfg.enable_filter_overrides) {
if (!strcmp(name, "about-filter"))
repo->about_filter = cgit_new_filter(value, ABOUT);
@@ -93,10 +97,6 @@ static void repo_config(struct cgit_repo *repo, const char 
*name, const char *va
repo->email_filter = cgit_new_filter(value, EMAIL);
else if (!strcmp(name, "owner-filter"))
repo->owner_filter = cgit_new_filter(value, OWNER);
-   } else if (!strcmp(name, "hide")) {
-   repo->hide = atoi(value);
-   } else if (!strcmp(name, "ignore")) {
-   repo->ignore = atoi(value);
}
 }
 
-- 
2.1.4

___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


[PATCH] Fix processing of repo.hide and repo.ignore

2015-08-06 Thread Daniel Reichelt
Hi,

please find attached a patch which fixes processing of repo.hide and
repo.ignore.
These options currently get ignored, if the global option
enable-filter-overrides is enabled.

Please CC me on replies, I'm not subscribed.

Cheers
Daniel

>From ebc76bf727aba915536f15a6243f301340c29a27 Mon Sep 17 00:00:00 2001
From: Daniel Reichelt 
Date: Fri, 7 Aug 2015 06:21:25 +0200
Subject: [PATCH] Fix processing of repo.hide and repo.ignore

If the global option enable-filter-overrides is set to 1 the repo-specific
options repo.hide and repo.ignore never got processed.
---
 cgit.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/cgit.c b/cgit.c
index ae413c6..8c9cfb5 100644
--- a/cgit.c
+++ b/cgit.c
@@ -82,6 +82,10 @@ static void repo_config(struct cgit_repo *repo, const char *name, const char *va
 		repo->logo = xstrdup(value);
 	else if (!strcmp(name, "logo-link") && value != NULL)
 		repo->logo_link = xstrdup(value);
+	else if (!strcmp(name, "hide"))
+		repo->hide = atoi(value);
+	else if (!strcmp(name, "ignore"))
+		repo->ignore = atoi(value);
 	else if (ctx.cfg.enable_filter_overrides) {
 		if (!strcmp(name, "about-filter"))
 			repo->about_filter = cgit_new_filter(value, ABOUT);
@@ -93,10 +97,6 @@ static void repo_config(struct cgit_repo *repo, const char *name, const char *va
 			repo->email_filter = cgit_new_filter(value, EMAIL);
 		else if (!strcmp(name, "owner-filter"))
 			repo->owner_filter = cgit_new_filter(value, OWNER);
-	} else if (!strcmp(name, "hide")) {
-		repo->hide = atoi(value);
-	} else if (!strcmp(name, "ignore")) {
-		repo->ignore = atoi(value);
 	}
 }
 
-- 
2.1.4


___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


Re: Relative URL for Atom feed announcement

2014-01-08 Thread Daniel Reichelt
> Apparently there's some issue with firefox and relative atom/rss
> s? Can you look into this and confirm/deny first?

Sry I misunderstood your mail.

I can confirm my patch to work with Debian/Wheezy's Iceweasel (based on
FF 17.0.10) and current FF/Win (26.0)

cu
Daniel

___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


Re: Relative URL for Atom feed announcement

2014-01-08 Thread Daniel Reichelt
Hi Jason,

> Apparently there's some issue with firefox and relative atom/rss
> s? Can you look into this and confirm/deny first?

The issue is not with the browser, the URL gets created wrongly by cgit
due to my reverse-proxy setup. (A plain wget to external vhost also
returns the full-qualified http://localhost:446/ URL)

cu
Daniel

___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit


Relative URL for Atom feed announcement

2013-11-29 Thread Daniel Reichelt
Hi folks,


rationale for this patch:

* Debian wheezy
* VirtualHost container for git repositories (running under a different
user than www-data using apache2-mpm-itk on port 446)
* include said vhost via reverse proxy in the main https site


Calling the main site, the Atom feed URL gets created as

---8<-

---8<-

which is obviously useless. As far as I can tell every other URL is
created as relative href, so the attached patch changes the feed URL to
a relative one as well, namely

---8<-

---8<-


Thanks!


Cheers,

Daniel
>From 1d064d00d958228ef4782f02f5ae42a58bf44a2b Mon Sep 17 00:00:00 2001
From: Daniel Reichelt 
Date: Sat, 30 Nov 2013 06:32:36 +0100
Subject: [PATCH] use relative URL for 

---
 ui-shared.c |2 --
 1 file changed, 2 deletions(-)

diff --git a/ui-shared.c b/ui-shared.c
index 7ab2ab1..5c1dec8 100644
--- a/ui-shared.c
+++ b/ui-shared.c
@@ -681,8 +681,6 @@ void cgit_print_docstart(struct cgit_context *ctx)
 		strbuf_addf(&sb, "h=%s", ctx->qry.head);
 
 		html("\n");
-- 
1.7.10.4

___
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit