xaizek / rocketgit (License: AGPLv3+) (since 2018-12-09)
Light and fast Git hosting solution suitable to serve both as a hub or as a personal code storage with its tickets, pull requests, API and much more.
Commit 132cd07d19e33b382ab4e7a0a0b0e057fe316652

Add caching by using ETag / If-None-Match
Author: Catalin(ux) M. BOIE
Author date (UTC): 2015-06-09 16:03
Committer name: Catalin(ux) M. BOIE
Committer date (UTC): 2015-06-09 16:03
Parent(s): c091b24f82c135b5606181f417d2f18151d951ae
Signing key:
Tree: 30e94993181485bd3c9eb62f5c5b8a9821fdbdbf
File Lines added Lines deleted
root/index.php 20 1
File root/index.php changed (mode: 100644) (index 65596f0..4a18a23)
... ... if ($rg['login_ui']['uid'] > 0) {
156 156
157 157 $rg['HTML:rg_body'] = $body; $rg['HTML:rg_body'] = $body;
158 158 // DEBUG: aici deja e busit content-ul! Merg inapoi pe fir. // DEBUG: aici deja e busit content-ul! Merg inapoi pe fir.
159 echo rg_template("index.html", $rg, TRUE /* xss */);
159 $_c = rg_template("index.html", $rg, TRUE /* xss */);
160
161 header('Cache-Control: private, no-cache');
162
163 // Caching
164 $we_have = sha1($_c);
165 if (isset($_SERVER['HTTP_IF_NONE_MATCH']))
166 $client_have = $_SERVER['HTTP_IF_NONE_MATCH'];
167 else
168 $client_have = '';
169
170 if (strcmp($client_have, $we_have) == 0) {
171 rg_log('Client has the right version');
172 header('HTTP/1.1 304 Not modified');
173 header('ETag: ' . $we_have);
174 } else {
175 rg_log('Client has NOT the right version [' . $client_have . ']');
176 header('ETag: ' . $we_have);
177 echo $_c;
178 }
160 179
161 180 rg_prof_end("MAIN"); rg_prof_end("MAIN");
162 181 rg_prof_log(); rg_prof_log();
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/rocketgit

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/rocketgit

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master