git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: kernel.org mirroring (Re: [GIT PULL] MMC update)

From
Jakub Narebski <jnareb@gmail.com>
Date
Dec 10, 2006, 22:59 UTC
Message-ID
<200612102359.20083.jnareb@gmail.com>
In-Reply-To
<457C84AC.7060105@garzik.org>
Jeff Garzik wrote:
Show 16 quoted lines
> Jakub Narebski wrote:
>>
>> And in CGI standard there is a way to access additional HTTP headers
>> info from CGI script: the envirionmental variables are HTTP_HEADER,
>> for example if browser sent If-Modified-Since: header it's value
>> can be found in HTTP_IF_MODIFIED_SINCE environmental variable.
> 
> The CGI spec does not at all guarantee that the CGI environment will 
> contain all the HTTP headers sent by the client.  That was the point of 
> the environment dump script -- you can see exactly which headers are, 
> and are not, passed through to CGI.
> 
> CGI only /guarantees/ a bare minimum (things like QUERY_STRING, 
> PATH_INFO, etc.)
> 
> Even basic server info environment variables are optional.
I have checked that at least Apache 2.0.54 passes HTTP_IF_MODIFIED_SINCE
when getting If-Modified-Since: header (my own script + netcat/nc).
 
Show 6 quoted lines
>> It is ETag, not E-tag. Besides, I don't see what the attached script is
>> meant to do: it does not output the sample file anyway.
> 
> It's not meant to output the sample file.  It outputs the server 
> metadata sent to the CGI script (the environment variables).  The sample 
> file was simply a way to play around with etag and last-modified metadata.
Ah. 
 
Show 6 quoted lines
>> The idea is of course to stop processing in CGI script / mod_perl script
>> as soon as possible if cache validates.
> 
> Certainly.  That should help cut down on I/O.  FWIW though the projects 
> list is particularly painful, with its File::Find call, which you'll 
> need to do in order to return 304-not-modified.
First, it is better to use $projects_list which is projects index file
in the format:
  <project path> SPC <project owner>
where <project path> is relative to $projectroot and is URI encoded; well
at least SPC has to be URI (percent) encoded. <project owner> is owner
of given project, and is also URI encoded (one would usually use '+' in
the place of SPC here).

Gitweb now can generate projects list in above format, by using "project_index" action ("a=project_index" query string), or by clicking 'TXT' link at the bottom of the projects list page in new gitweb: see http://repo.or.cz by Petr Baudis. The problem is that it generates projects list from the list of projects it sees, so to generate it from scratch from the filesystem you have for generating "project_index" to have $projects_list a directory (changing it to something that evals to false, e.g. undef or "" makes gitweb use $projectroot for $projects_list). I have posted how to do this.

The project list changes rarely, only on addition/removal of project, and on changing owner of project; so it can be generated on demand.

Second, even with $projects_list being set to projects index file as of now gitweb runs git-for-each-ref (which scans refs and access pack file for commit date), checks for description file and reads it; for $projects_list being directory it also checks project directory owner. I plan to make it configurable to read last activity from all heads (all branches) as it is now, from HEAD (current branch) as it was before, or given branch (for example 'master').

Assuming that gitweb is configured to read last activity from single
defined branch, generating ETag = checksum(sha1 of heads of projects)
needs at least read one file from each project.
 
Show 11 quoted lines
>> I don't know if Apache intercepts and remembers ETag and Last-Modified
>> headers, adds 304 Not Modified HTTP response on finding that cache validates
>> and cuts out CGI script output. I.e. if browser provided If-Modified-Since:,
>> script wrote Last-Modified: header, If-Modified-Since: is no earlier than
>> Last-Modified: (usually is equal in the case of cache validation), then
>> Apache provides 304 Not Modified response instead of CGI script output.
> 
> This wanders into the realm of mod_cache configuration, I think.  (which 
> I have tried to get working as reverse proxy, and failed serveral times) 
>   If you are not using mod_*_cache, then Apache must execute the CGI 
> script every time AFAICS, regardless of etag/[if-]last-mod headers.

No, it wanders into realm of header parsing by Apache, and NPH (No Parse Headers) option.

Even if Apache does execute CGI script to completion every time, it might not send the output of the script, but HTTP 304 Not Modified reply. Might. I don't know if it does.

-- 
Jakub Narebski
Previous: Jeff GarzikNext: Martin Langhoff
Message 59 of 80 in “Re: kernel.org mirroring (Re: [GIT PULL] MMC update)”
  1. Linus TorvaldsDec 7, 2006
  2. H. Peter AnvinDec 7, 2006
  3. Olivier GalibertDec 7, 2006
  4. H. Peter AnvinDec 7, 2006
  5. Olivier GalibertDec 7, 2006
  6. H. Peter AnvinDec 7, 2006
  7. Jakub NarebskiDec 8, 2006
  8. Rogan DawesDec 8, 2006
  9. Jakub NarebskiDec 8, 2006
  10. Rogan DawesDec 8, 2006
  11. Jonas FonsecaDec 8, 2006
  12. Martin LanghoffDec 9, 2006
  13. H. Peter AnvinDec 9, 2006
  14. Martin LanghoffDec 9, 2006
  15. H. Peter AnvinDec 9, 2006
  16. Martin LanghoffDec 9, 2006
  17. H. Peter AnvinDec 9, 2006
  18. H. Peter AnvinDec 8, 2006
  19. Linus TorvaldsDec 8, 2006
  20. H. Peter AnvinDec 8, 2006
  21. Lars HjemliDec 8, 2006
  22. H. Peter AnvinDec 8, 2006
  23. Lars HjemliDec 8, 2006
  24. H. Peter AnvinDec 8, 2006
  25. rdaDec 10, 2006
  26. Jeff GarzikDec 8, 2006
  27. H. Peter AnvinDec 8, 2006
  28. Jeff GarzikDec 8, 2006
  29. Linus TorvaldsDec 8, 2006
  30. Michael K. EdwardsDec 8, 2006
  31. H. Peter AnvinDec 8, 2006
  32. Michael K. EdwardsDec 9, 2006
  33. H. Peter AnvinDec 9, 2006
  34. Linus TorvaldsDec 9, 2006
  35. H. Peter AnvinDec 9, 2006
  36. Michael K. EdwardsDec 9, 2006
  37. Jeff GarzikDec 9, 2006
  38. Martin LanghoffDec 9, 2006
  39. Jakub NarebskiDec 9, 2006
  40. Jeff GarzikDec 9, 2006
  41. Jakub NarebskiDec 9, 2006
  42. Jeff GarzikDec 9, 2006
  43. Jakub NarebskiDec 9, 2006
  44. Jeff GarzikDec 9, 2006
  45. Martin LanghoffDec 10, 2006
  46. Jakub NarebskiDec 10, 2006
  47. Jeff GarzikDec 10, 2006
  48. Jakub NarebskiDec 10, 2006
  49. Jeff GarzikDec 10, 2006
  50. Jakub NarebskiDec 10, 2006
  51. Linus TorvaldsDec 10, 2006
  52. Jakub NarebskiDec 10, 2006
  53. Linus TorvaldsDec 10, 2006
  54. Martin LanghoffDec 10, 2006
  55. Jeff GarzikDec 10, 2006
  56. Jeff GarzikDec 10, 2006
  57. H. Peter AnvinDec 10, 2006
  58. Jeff GarzikDec 10, 2006
  59. Jakub NarebskiDec 10, 2006
  60. Martin LanghoffDec 11, 2006
  61. Jakub NarebskiDec 11, 2006
  62. Martin LanghoffDec 11, 2006
  63. Linus TorvaldsDec 9, 2006
  64. H. Peter AnvinDec 9, 2006
  65. Martin LanghoffDec 10, 2006
  66. H. Peter AnvinDec 10, 2006
  67. Jakub NarebskiDec 12, 2006
  68. Steven GrimmDec 9, 2006
  69. Linus TorvaldsDec 7, 2006
  70. Shawn PearceDec 7, 2006
  71. Linus TorvaldsDec 7, 2006
  72. Michael K. EdwardsDec 7, 2006
  73. H. Peter AnvinDec 7, 2006
  74. Junio C HamanoDec 7, 2006
  75. H. Peter AnvinDec 7, 2006
  76. Junio C HamanoDec 7, 2006
  77. Jakub NarebskiDec 8, 2006
  78. Linus TorvaldsDec 9, 2006
  79. H. Peter AnvinDec 9, 2006
  80. Jeff GarzikDec 9, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.