{"thread":{"id":"17317","subject":"[PATCH 1/4] gitweb: channel image in rss feed","startedAt":"2009-01-23T04:48:37Z","lastAt":"2009-02-02T22:28:12Z","messageCount":13,"participants":["Giuseppe Bilotta","Jakub Narebski"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"101608","messageId":"1232686121-1800-1-git-send-email-giuseppe.bilotta@gmail.com","threadId":"17317","inReplyTo":null,"subject":"[PATCH 0/4] gitweb feed metadata tuneups","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2009-01-23T04:48:37Z","receivedAt":"2009-01-23T04:48:37Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"The next four patches add some metadata to gitweb generated feeds:\nchannel image, managing editor and last-update dates are added to RSS\nfeeds, and the feed generator (gitweb, with version specification) is\nadded to both RSS and Atom feeds.\n\nGiuseppe Bilotta (4):\n  gitweb: channel image in rss feed\n  gitweb: feed generator metadata\n  gitweb: rss feed managingEditor\n  gitweb: rss channel date\n\n gitweb/gitweb.perl |   20 +++++++++++++++++++-\n 1 files changed, 19 insertions(+), 1 deletions(-)\n"},{"id":"101607","messageId":"1232686121-1800-2-git-send-email-giuseppe.bilotta@gmail.com","threadId":"17317","inReplyTo":"1232686121-1800-1-git-send-email-giuseppe.bilotta@gmail.com","subject":"[PATCH 1/4] gitweb: channel image in rss feed","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2009-01-23T04:48:38Z","receivedAt":"2009-01-23T04:48:38Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"Define the channel image for the rss feed when the logo or favicon are\ndefined, preferring the former to the latter. As suggested in the RSS\n2.0 specifications, the image's title and link as set to the same as the\nchannel's.\n\nSigned-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n---\n gitweb/gitweb.perl |   10 ++++++++++\n 1 files changed, 10 insertions(+), 0 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 931db4f..f8a5d2e 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -6075,6 +6075,16 @@ XML\n \t\t      \"<link>$alt_url</link>\\n\" .\n \t\t      \"<description>$descr</description>\\n\" .\n \t\t      \"<language>en</language>\\n\";\n+\t\tif (defined $logo || defined $favicon) {\n+\t\t\t# prefer the logo to the favicon, since RSS\n+\t\t\t# doesn't allow both\n+\t\t\tmy $img = esc_url($logo || $favicon);\n+\t\t\tprint \"<image>\\n\" .\n+\t\t\t      \"<url>$img</url>\\n\" .\n+\t\t\t      \"<title>$title</title>\\n\" .\n+\t\t\t      \"<link>$alt_url</link>\\n\" .\n+\t\t\t      \"</image>\\n\";\n+\t\t}\n \t} elsif ($format eq 'atom') {\n \t\tprint <<XML;\n <feed xmlns=\"http://www.w3.org/2005/Atom\">\n-- \n1.5.6.5\n"},{"id":"101609","messageId":"1232686121-1800-3-git-send-email-giuseppe.bilotta@gmail.com","threadId":"17317","inReplyTo":"1232686121-1800-2-git-send-email-giuseppe.bilotta@gmail.com","subject":"[PATCH 2/4] gitweb: feed generator metadata","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2009-01-23T04:48:39Z","receivedAt":"2009-01-23T04:48:39Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"Add <generator> tag to RSS and Atom feed. Versioning info (gitweb/git\ncore versions, separated by a literal slash) is stored in the\nappropriate attribute for the Atom feed, and in the tag content for the\nRSS feed.\n\nSigned-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n---\n gitweb/gitweb.perl |    2 ++\n 1 files changed, 2 insertions(+), 0 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex f8a5d2e..3d94f50 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -6085,6 +6085,7 @@ XML\n \t\t\t      \"<link>$alt_url</link>\\n\" .\n \t\t\t      \"</image>\\n\";\n \t\t}\n+\t\tprint \"<generator>gitweb v.$version/$git_version</generator>\\n\";\n \t} elsif ($format eq 'atom') {\n \t\tprint <<XML;\n <feed xmlns=\"http://www.w3.org/2005/Atom\">\n@@ -6111,6 +6112,7 @@ XML\n \t\t} else {\n \t\t\tprint \"<updated>$latest_date{'iso-8601'}</updated>\\n\";\n \t\t}\n+\t\tprint \"<generator version='$version/$git_version'>gitweb</generator>\\n\";\n \t}\n \n \t# contents\n-- \n1.5.6.5\n"},{"id":"101610","messageId":"1232686121-1800-4-git-send-email-giuseppe.bilotta@gmail.com","threadId":"17317","inReplyTo":"1232686121-1800-3-git-send-email-giuseppe.bilotta@gmail.com","subject":"[PATCH 3/4] gitweb: rss feed managingEditor","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2009-01-23T04:48:40Z","receivedAt":"2009-01-23T04:48:40Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"The RSS 2.0 specification allows an optional managingEditor tag for the\nchannel, containing the \"email address for person responsible for editorial\ncontent\", which is basically the project owner.\n\nSigned-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n---\n gitweb/gitweb.perl |    4 +++-\n 1 files changed, 3 insertions(+), 1 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 3d94f50..cc6d0fb 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -6074,7 +6074,9 @@ XML\n \t\tprint \"<title>$title</title>\\n\" .\n \t\t      \"<link>$alt_url</link>\\n\" .\n \t\t      \"<description>$descr</description>\\n\" .\n-\t\t      \"<language>en</language>\\n\";\n+\t\t      \"<language>en</language>\\n\" .\n+\t\t      # project owner is responsible for 'editorial' content\n+\t\t      \"<managingEditor>$owner</managingEditor>\\n\";\n \t\tif (defined $logo || defined $favicon) {\n \t\t\t# prefer the logo to the favicon, since RSS\n \t\t\t# doesn't allow both\n-- \n1.5.6.5\n"},{"id":"101611","messageId":"1232686121-1800-5-git-send-email-giuseppe.bilotta@gmail.com","threadId":"17317","inReplyTo":"1232686121-1800-4-git-send-email-giuseppe.bilotta@gmail.com","subject":"[PATCH 4/4] gitweb: rss channel date","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2009-01-23T04:48:41Z","receivedAt":"2009-01-23T04:48:41Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"The RSS 2.0 specifications defines not one but _two_ dates for its\nchannel element! Woohoo! Luckily, it seems that consensus seems to be\nthat if both are present they should be equal, except for some very\nobscure and discouraged cases. Since lastBuildDate would make more sense\nfor us and pubDate seems to be the most commonly used, we defined both\nand make them equal.\n\nSigned-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>\n---\n gitweb/gitweb.perl |    4 ++++\n 1 files changed, 4 insertions(+), 0 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex cc6d0fb..756868a 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -6087,6 +6087,10 @@ XML\n \t\t\t      \"<link>$alt_url</link>\\n\" .\n \t\t\t      \"</image>\\n\";\n \t\t}\n+\t\tif (%latest_date) {\n+\t\t\tprint \"<pubDate>$latest_date{'rfc2822'}</pubDate>\\n\";\n+\t\t\tprint \"<lastBuildDate>$latest_date{'rfc2822'}</lastBuildDate>\\n\";\n+\t\t}\n \t\tprint \"<generator>gitweb v.$version/$git_version</generator>\\n\";\n \t} elsif ($format eq 'atom') {\n \t\tprint <<XML;\n-- \n1.5.6.5\n"},{"id":"101746","messageId":"200901241702.38224.jnareb@gmail.com","threadId":"17317","inReplyTo":"1232686121-1800-1-git-send-email-giuseppe.bilotta@gmail.com","subject":"Re: [PATCH 0/4] gitweb feed metadata tuneups","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-01-24T16:02:36Z","receivedAt":"2009-01-24T16:02:36Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Fri, 23 Jan 2009, Giuseppe Bilotta wrote:\n\n> The next four patches add some metadata to gitweb generated feeds:\n> channel image, managing editor and last-update dates are added to RSS\n> feeds, and the feed generator (gitweb, with version specification) is\n> added to both RSS and Atom feeds.\n> \n> Giuseppe Bilotta (4):\n>   gitweb: channel image in rss feed\n>   gitweb: feed generator metadata\n>   gitweb: rss feed managingEditor\n>   gitweb: rss channel date\n> \n>  gitweb/gitweb.perl |   20 +++++++++++++++++++-\n>  1 files changed, 19 insertions(+), 1 deletions(-)\n\nI like this series; however I do not use gitweb feeds (Atom or RSS),\nso I cannot say anything on their validity and usefullness.\n\nP.S. I tried to look up who is responsible (who have added) RSS code,\nbut unfortunately it looks like it dates back to Kay Sievers.\nUnfortunately because IIRC he is not active on the list...\n-- \nJakub Narebski\nPoland\n"},{"id":"101888","messageId":"1232923370-4427-1-git-send-email-giuseppe.bilotta@gmail.com","threadId":"17317","inReplyTo":"1232686121-1800-5-git-send-email-giuseppe.bilotta@gmail.com","subject":"[PATCH] gitweb: last-modified time should be commiter, not author","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2009-01-25T22:42:49Z","receivedAt":"2009-01-25T22:42:49Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"The last-modified time header added by RSS to increase cache hits from\nreaders should be set to the date the repository was last modified. The\nauthor time in this respect is not a good guess because the last commit\nmight come from a oldish patch.\n\nUse the committer time for the last-modified header to ensure a more\ncorrect guess of the last time the repository was modified.\n---\n gitweb/gitweb.perl |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 756868a..8c49c75 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -6015,7 +6015,7 @@ sub git_feed {\n \t}\n \tif (defined($commitlist[0])) {\n \t\t%latest_commit = %{$commitlist[0]};\n-\t\t%latest_date   = parse_date($latest_commit{'author_epoch'});\n+\t\t%latest_date   = parse_date($latest_commit{'committer_epoch'});\n \t\tprint $cgi->header(\n \t\t\t-type => $content_type,\n \t\t\t-charset => 'utf-8',\n-- \n1.5.6.5\n"},{"id":"101890","messageId":"1232923370-4427-2-git-send-email-giuseppe.bilotta@gmail.com","threadId":"17317","inReplyTo":"1232923370-4427-1-git-send-email-giuseppe.bilotta@gmail.com","subject":"[PATCH] gitweb: check if-modified-since for feeds","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2009-01-25T22:42:50Z","receivedAt":"2009-01-25T22:42:50Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"Offering Last-modified header for feeds is only half the work: we should\nalso check that same date against If-modified-since, and bail out early\nwith 304 Not Modified.\n---\n gitweb/gitweb.perl |   20 +++++++++++++++++++-\n 1 files changed, 19 insertions(+), 1 deletions(-)\n\ndiff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\nindex 8c49c75..0a5d229 100755\n--- a/gitweb/gitweb.perl\n+++ b/gitweb/gitweb.perl\n@@ -6015,7 +6015,25 @@ sub git_feed {\n \t}\n \tif (defined($commitlist[0])) {\n \t\t%latest_commit = %{$commitlist[0]};\n-\t\t%latest_date   = parse_date($latest_commit{'committer_epoch'});\n+\t\tmy $latest_epoch = $latest_commit{'committer_epoch'};\n+\t\t%latest_date   = parse_date($latest_epoch);\n+\t\tmy $if_modified = $cgi->http('IF_MODIFIED_SINCE');\n+\t\tif (defined $if_modified) {\n+\t\t\tmy $since;\n+\t\t\tif (eval { require HTTP::Date; 1; }) {\n+\t\t\t\t$since = HTTP::Date::str2time($if_modified);\n+\t\t\t} elsif (eval { require Time::ParseDate; 1; }) {\n+\t\t\t\t$since = Time::ParseDate::parsedate($if_modified, GMT => 1);\n+\t\t\t}\n+\t\t\tif (defined $since && $latest_epoch <= $since) {\n+\t\t\t\tprint $cgi->header(\n+\t\t\t\t\t-type => $content_type,\n+\t\t\t\t\t-charset => 'utf-8',\n+\t\t\t\t\t-last_modified => $latest_date{'rfc2822'},\n+\t\t\t\t\t-status => 304);\n+\t\t\t\treturn;\n+\t\t\t}\n+\t\t}\n \t\tprint $cgi->header(\n \t\t\t-type => $content_type,\n \t\t\t-charset => 'utf-8',\n-- \n1.5.6.5\n"},{"id":"101931","messageId":"200901260254.49919.jnareb@gmail.com","threadId":"17317","inReplyTo":"1232923370-4427-1-git-send-email-giuseppe.bilotta@gmail.com","subject":"Re: [PATCH] gitweb: last-modified time should be commiter, not author","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-01-26T01:54:49Z","receivedAt":"2009-01-26T01:54:49Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Sun, 25 Jan 2009, Giuseppe Bilotta wrote:\n\n> Subject: [PATCH] gitweb: last-modified time should be commiter, not author\n\nShould be really either \"[PATCH 1/2]\" or \"[PATCH 5/4]\" or \"[PATCH 5/6]\"\njust in case for the next patch, because next patch _depends_ on this\none, and just in case of threading problem it should be marked as it;\nit also makes easier to apply patches from emails saved as individual\nfiles each.\n\n>\n> The last-modified time header added by RSS to increase cache hits from\n> readers should be set to the date the repository was last modified. The\n> author time in this respect is not a good guess because the last commit\n> might come from a oldish patch.\n> \n> Use the committer time for the last-modified header to ensure a more\n> correct guess of the last time the repository was modified.\n\nGood catch, good thinking IMHO. Committer date has much better chance\nto be monotonic than author date, and is more close related to \n_publishing_ date (author date is more of _creation_ date).\n\nLack signoff; if Junio forges it (or you reply that it should be\nsigned off), you can add from me\n\nAcked-by: Jakub Narebski <jnareb@gmail.com>\n\n\nP.S. I wonder what other web interfaces do, for example cgit. I guess\nthat web interfaces for other SCMs like SVN::Web, ViewVC etc. do not\nhave this problem because they have only one, single date.\n\n> ---\n>  gitweb/gitweb.perl |    2 +-\n>  1 files changed, 1 insertions(+), 1 deletions(-)\n> \n> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\n> index 756868a..8c49c75 100755\n> --- a/gitweb/gitweb.perl\n> +++ b/gitweb/gitweb.perl\n> @@ -6015,7 +6015,7 @@ sub git_feed {\n>  \t}\n>  \tif (defined($commitlist[0])) {\n>  \t\t%latest_commit = %{$commitlist[0]};\n> -\t\t%latest_date   = parse_date($latest_commit{'author_epoch'});\n> +\t\t%latest_date   = parse_date($latest_commit{'committer_epoch'});\n>  \t\tprint $cgi->header(\n>  \t\t\t-type => $content_type,\n>  \t\t\t-charset => 'utf-8',\n> -- \n> 1.5.6.5\n> \n> \n\n-- \nJakub Narebski\nPoland\n"},{"id":"101933","messageId":"200901260318.05301.jnareb@gmail.com","threadId":"17317","inReplyTo":"1232923370-4427-2-git-send-email-giuseppe.bilotta@gmail.com","subject":"Re: [PATCH] gitweb: check if-modified-since for feeds","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-01-26T02:18:05Z","receivedAt":"2009-01-26T02:18:05Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Should be \"[PATCH 2/2]\" or similar, just in case.\n\nOn Sun, 25 Jun 2009, Giuseppe Bilotta wrote:\n\n> Offering Last-modified header\n\nAnd skipping generating the body if client uses 'HEAD' request to\nget only Last-Modified header.\n\n>                              for feeds is only half the work: we should \n> also check that same date against If-modified-since, and bail out early\n> with 304 Not Modified.\n\nLacks signoff.\n\n> ---\n>  gitweb/gitweb.perl |   20 +++++++++++++++++++-\n>  1 files changed, 19 insertions(+), 1 deletions(-)\n> \n> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl\n> index 8c49c75..0a5d229 100755\n> --- a/gitweb/gitweb.perl\n> +++ b/gitweb/gitweb.perl\n> @@ -6015,7 +6015,25 @@ sub git_feed {\n>  \t}\n>  \tif (defined($commitlist[0])) {\n>  \t\t%latest_commit = %{$commitlist[0]};\n> -\t\t%latest_date   = parse_date($latest_commit{'committer_epoch'});\n> +\t\tmy $latest_epoch = $latest_commit{'committer_epoch'};\n> +\t\t%latest_date   = parse_date($latest_epoch);\n> +\t\tmy $if_modified = $cgi->http('IF_MODIFIED_SINCE');\n> +\t\tif (defined $if_modified) {\n> +\t\t\tmy $since;\n> +\t\t\tif (eval { require HTTP::Date; 1; }) {\n> +\t\t\t\t$since = HTTP::Date::str2time($if_modified);\n> +\t\t\t} elsif (eval { require Time::ParseDate; 1; }) {\n> +\t\t\t\t$since = Time::ParseDate::parsedate($if_modified, GMT => 1);\n> +\t\t\t}\n\nI'd really like to fallback on hand-parsing, as we have to parse date\nin well defined HTTP-date format (RFC-1123, update to RFC-822), which\nI think is what we send in Last-Modified header (or is it RFC-2822?).\n\nBut that might be too much work. I like the checking for modules,\nand the fallback cascade, but could you explain why in this order?\n\n> +\t\t\tif (defined $since && $latest_epoch <= $since) {\n> +\t\t\t\tprint $cgi->header(\n> +\t\t\t\t\t-type => $content_type,\n> +\t\t\t\t\t-charset => 'utf-8',\n> +\t\t\t\t\t-last_modified => $latest_date{'rfc2822'},\n> +\t\t\t\t\t-status => 304);\n\nI think we spell HTTP status messages in full (even if it is hidden\nin die_error subroutine), i.e.\n\n+\t\t\t\t\t-status => '304 Not Modified');\n\n> +\t\t\t\treturn;\n> +\t\t\t}\n> +\t\t}\n>  \t\tprint $cgi->header(\n>  \t\t\t-type => $content_type,\n>  \t\t\t-charset => 'utf-8',\n> -- \n> 1.5.6.5\n> \n> \n\nP.S. It would be nice to have this mechanism (responding to\ncache-control headers such as If-Modified-Since) for all of gitweb,\nbut I guess it is most critical for feeds, which are _polled_.\n\n-- \nJakub Narebski\nPoland\n"},{"id":"101965","messageId":"cb7bb73a0901260325j74f07f3doee3aad9b0300ee88@mail.gmail.com","threadId":"17317","inReplyTo":"200901260318.05301.jnareb@gmail.com","subject":"Re: [PATCH] gitweb: check if-modified-since for feeds","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2009-01-26T11:25:18Z","receivedAt":"2009-01-26T11:25:18Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"On Mon, Jan 26, 2009 at 3:18 AM, Jakub Narebski <jnareb@gmail.com> wrote:\n> Should be \"[PATCH 2/2]\" or similar, just in case.\n\nYeah, but I was just hacking up ideas as they came. I'm planning a\nresend of the whole series, properly numbered and all.\n\n> On Sun, 25 Jun 2009, Giuseppe Bilotta wrote:\n>\n>> Offering Last-modified header\n>\n> And skipping generating the body if client uses 'HEAD' request to\n> get only Last-Modified header.\n>\n>>                              for feeds is only half the work: we should\n>> also check that same date against If-modified-since, and bail out early\n>> with 304 Not Modified.\n>\n> Lacks signoff.\n\nOh yeah.\n\n>> -             %latest_date   = parse_date($latest_commit{'committer_epoch'});\n>> +             my $latest_epoch = $latest_commit{'committer_epoch'};\n>> +             %latest_date   = parse_date($latest_epoch);\n>> +             my $if_modified = $cgi->http('IF_MODIFIED_SINCE');\n>> +             if (defined $if_modified) {\n>> +                     my $since;\n>> +                     if (eval { require HTTP::Date; 1; }) {\n>> +                             $since = HTTP::Date::str2time($if_modified);\n>> +                     } elsif (eval { require Time::ParseDate; 1; }) {\n>> +                             $since = Time::ParseDate::parsedate($if_modified, GMT => 1);\n>> +                     }\n>\n> I'd really like to fallback on hand-parsing, as we have to parse date\n> in well defined HTTP-date format (RFC-1123, update to RFC-822), which\n> I think is what we send in Last-Modified header (or is it RFC-2822?).\n>\n> But that might be too much work. I like the checking for modules,\n> and the fallback cascade, but could you explain why in this order?\n\nOf course, if we have our own parsing code, we don't need the other\nmodules. I'm way too lazy to write the parsing code myself, although a\ncopypaste from existing GPL code would do it.\n\n(BTW, I asked on #perl and they think gitweb non-reliance on CPAN\nmakes for some very horrible code. Of course, IMO the real problem is\nthat perl's stdlib is way too limited, but that is likely to causes a\nlanguage war so I refrained from discussing the thing.)\n\nThe order is almost casual, but I suspect that HTTP::Date, from\nlibwww-perl, is more likely to be available on a webserver than the\nother.\n\n>> +                     if (defined $since && $latest_epoch <= $since) {\n>> +                             print $cgi->header(\n>> +                                     -type => $content_type,\n>> +                                     -charset => 'utf-8',\n>> +                                     -last_modified => $latest_date{'rfc2822'},\n>> +                                     -status => 304);\n>\n> I think we spell HTTP status messages in full (even if it is hidden\n> in die_error subroutine), i.e.\n>\n> +                                       -status => '304 Not Modified');\n\nCan do that.\n\n> P.S. It would be nice to have this mechanism (responding to\n> cache-control headers such as If-Modified-Since) for all of gitweb,\n> but I guess it is most critical for feeds, which are _polled_.\n\nI thought so too, but then again I couldn't see where last-modified\nwas used. (Its usage could be added, of course.)\n\n-- \nGiuseppe \"Oblomov\" Bilotta\n"},{"id":"101968","messageId":"cb7bb73a0901260343leebb09fld144f1dec7c8470a@mail.gmail.com","threadId":"17317","inReplyTo":"200901260254.49919.jnareb@gmail.com","subject":"Re: [PATCH] gitweb: last-modified time should be commiter, not author","fromName":"Giuseppe Bilotta","fromEmail":"giuseppe.bilotta@gmail.com","sentAt":"2009-01-26T11:43:11Z","receivedAt":"2009-01-26T11:43:11Z","isPatch":true,"sender":{"key":"giuseppe.bilotta@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1464?v=4"},"body":"On Mon, Jan 26, 2009 at 2:54 AM, Jakub Narebski <jnareb@gmail.com> wrote:\n> On Sun, 25 Jan 2009, Giuseppe Bilotta wrote:\n>\n>> Subject: [PATCH] gitweb: last-modified time should be commiter, not author\n>\n> Should be really either \"[PATCH 1/2]\" or \"[PATCH 5/4]\" or \"[PATCH 5/6]\"\n> just in case for the next patch, because next patch _depends_ on this\n> one, and just in case of threading problem it should be marked as it;\n> it also makes easier to apply patches from emails saved as individual\n> files each.\n\nI'll resend the whole 6-patch series cc'ing Junio too\n\n>> Use the committer time for the last-modified header to ensure a more\n>> correct guess of the last time the repository was modified.\n>\n> Good catch, good thinking IMHO. Committer date has much better chance\n> to be monotonic than author date, and is more close related to\n> _publishing_ date (author date is more of _creation_ date).\n\nBTW, it is still not good enough. Consider a remote repo to which you\njust pushed some changes you commited last week. The last-modified\ndate would be last-week, even if you just pushed those changes.\n\nThis used to be a problem for us on ruby-rbot because even when\nwatching the feed we would get no updates on the irc channel (the bot\nthought the feed could still be cached). the if-modified thing seems\nto have fixed this though.\n\n> Lack signoff; if Junio forges it (or you reply that it should be\n> signed off), you can add from me\n>\n> Acked-by: Jakub Narebski <jnareb@gmail.com>\n>\n>\n> P.S. I wonder what other web interfaces do, for example cgit. I guess\n> that web interfaces for other SCMs like SVN::Web, ViewVC etc. do not\n> have this problem because they have only one, single date.\n\nHEAD'ing a cgit atom url gives a last-modified date one hour from the\nrequest, it seems. This is actually a typical (and not nice) behaviour\nof many CGI scripts.\n\n-- \nGiuseppe \"Oblomov\" Bilotta\n"},{"id":"102905","messageId":"200902022328.13690.jnareb@gmail.com","threadId":"17317","inReplyTo":"cb7bb73a0901260325j74f07f3doee3aad9b0300ee88@mail.gmail.com","subject":"Re: [PATCH] gitweb: check if-modified-since for feeds","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2009-02-02T22:28:12Z","receivedAt":"2009-02-02T22:28:12Z","isPatch":true,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"On Mon, 26 Jan 2009, Giuseppe Bilotta wrote:\n> On Mon, Jan 26, 2009 at 3:18 AM, Jakub Narebski <jnareb@gmail.com> wrote:\n>> On Sun, 25 Jun 2009, Giuseppe Bilotta wrote:\n\n>>> -             %latest_date   = parse_date($latest_commit{'committer_epoch'});\n>>> +             my $latest_epoch = $latest_commit{'committer_epoch'};\n>>> +             %latest_date   = parse_date($latest_epoch);\n>>> +             my $if_modified = $cgi->http('IF_MODIFIED_SINCE');\n>>> +             if (defined $if_modified) {\n>>> +                     my $since;\n>>> +                     if (eval { require HTTP::Date; 1; }) {\n>>> +                             $since = HTTP::Date::str2time($if_modified);\n>>> +                     } elsif (eval { require Time::ParseDate; 1; }) {\n>>> +                             $since = Time::ParseDate::parsedate($if_modified, GMT => 1);\n>>> +                     }\n>>\n>> I'd really like to fallback on hand-parsing, as we have to parse date\n>> in well defined HTTP-date format (RFC-1123, update to RFC-822), which\n>> I think is what we send in Last-Modified header (or is it RFC-2822?).\n>>\n>> But that might be too much work. I like the checking for modules,\n>> and the fallback cascade, but could you explain why in this order?\n> \n> Of course, if we have our own parsing code, we don't need the other\n> modules. I'm way too lazy to write the parsing code myself, although a\n> copypaste from existing GPL code would do it.\n> \n> (BTW, I asked on #perl and they think gitweb non-reliance on CPAN\n> makes for some very horrible code. Of course, IMO the real problem is\n> that perl's stdlib is way too limited, but that is likely to causes a\n> language war so I refrained from discussing the thing.)\n\nThe problem is (which was discussed on git mailing list) that gitweb\nis to be run on servers.  And admins are very reluctant on putting\nanything but well tested software on server.  The order is: in standard\ninstallation, in core distribution, in extras package of distribution,\nin trusted extras repository... random CPAN package is usually out of\nthe question.\n\n> \n> The order is almost casual, but I suspect that HTTP::Date, from\n> libwww-perl, is more likely to be available on a webserver than the\n> other.\n\nTrue.\n\nBTW. I have thought that we already require libwww-perl with the\nmodules we use in gitweb, but they are all packaged with Perl.\n\nWhile I don't think that there would be many complaints requiring\nlibwww-perl, I'd rather have it optional...\n\n-- \nJakub Narebski\nPoland\n"}]}