List of commits:
Subject Hash Author Date (UTC)
Improved error reporting when php-fpm receives chunked encoding fe158537256add633f02076e8359cd8f2267d54f Catalin(ux) M. BOIE 2017-04-29 14:46:18
Get rid of strage rewriting in we server config 8f845f11e9edfa5291965f570a5c971056416b62 Catalin(ux) M. BOIE 2017-04-29 14:43:23
Do not allow anyone to activate the debug (rg_debug). 0a296ec27e6988e91db8cac50e53345a8bce1c81 Catalin(ux) M. BOIE 2017-04-26 20:09:06
Forgot to add diff_too_big file b6297ed622b8fd1562f6ab05b279290367612b89 Catalin(ux) M. BOIE 2017-04-26 20:08:29
Added a functional test for http.postBuffer problem ff650d024cd5f82f796a225c204e156c9e1213f4 Catalin(ux) M. BOIE 2017-04-26 20:07:47
Added a 'Thanks' section e7c9731dd32fe48befc58bf08044fd5649f523f4 Catalin(ux) M. BOIE 2017-04-26 20:06:49
Some big fixes for push over http 56ebd277c71c50e40af9465cd3867dc885f054b9 Catalin(ux) M. BOIE 2017-04-26 20:00:53
Do not recursively set the rights - not needed a9edce3101ad2450b67a575265827aa69efd5c63 Catalin(ux) M. BOIE 2017-04-17 07:16:01
Cosmetic changes 4bb36da63972e7e152e4e476e84ed55baba02911 Catalin(ux) M. BOIE 2017-04-15 09:29:09
Add possibility for admin to limit the git log --patch limit 1865405c40ebe92aa1bc6fd4569dcbb0e3af476c Catalin(ux) M. BOIE 2017-04-15 09:28:46
Silent curl in API functional test e6808bc97d201fd4944de0ad2982c3090ae4743a Catalin(ux) M. BOIE 2017-04-15 06:31:04
Fixed a lot of tests which used time() for different fields and sometime lost the time race 6a61493189d07110d3c5fdbe34ea0725d5abbd3b Catalin(ux) M. BOIE 2017-04-15 06:25:40
Fixed the crash with big diffs by setting a limit 788e15942d8272685764a25b640eba2c07046437 Catalin(ux) M. BOIE 2017-04-15 06:24:30
Allow .well-known folder access 90519cd03bf64839d1a9fc2497e58bd63d8ce6f3 Catalin(ux) M. BOIE 2017-04-12 16:50:16
When an un-auth user is visiting a user page with no repo, do not invite to create a repo 6904e1eac3f46c281ae6b4757bcaa16d2acc6169 Catalin(ux) M. BOIE 2017-03-27 15:23:52
Added a 'push' target in Makefile to not forget to push tags... 92a9b78e26d8a3e7b466f5aa45678dd2db8d4310 Catalin(ux) M. BOIE 2017-03-26 14:29:55
Bump version to 0.67 6f1c9a6d7f7d40d65def54e23a3590556a346bb8 Catalin(ux) M. BOIE 2017-03-26 09:44:32
Cosmetic cb68f1921782a503675c592dc7484aa26b8815b6 Catalin(ux) M. BOIE 2017-03-26 09:37:41
Improve state handling: do not check for an old value; verify if table exists before doing a select 17d8eb4b4592dd96e62a8da74d87d3d3b26aeb86 Catalin(ux) M. BOIE 2017-03-26 09:37:01
Impoved debug for cache 4d6349f7143d61583e6d2d9612c89b55af4eea97 Catalin(ux) M. BOIE 2017-03-26 09:36:08
Commit fe158537256add633f02076e8359cd8f2267d54f - Improved error reporting when php-fpm receives chunked encoding
Author: Catalin(ux) M. BOIE
Author date (UTC): 2017-04-29 14:46
Committer name: Catalin(ux) M. BOIE
Committer date (UTC): 2017-04-29 14:46
Parent(s): 8f845f11e9edfa5291965f570a5c971056416b62
Signing key:
Tree: 586f8c05f23def7d003aec9d05a7c26197e172d3
File Lines added Lines deleted
inc/user.inc.php 79 47
File inc/user.inc.php changed (mode: 100644) (index cbb14f1..d163e79)
... ... function rg_user_list_to_full_info($db, $list)
1855 1855 * take care of it. * take care of it.
1856 1856 * Returns the uncompressed stream. * Returns the uncompressed stream.
1857 1857 */ */
1858 function rg_process_input($content_length, $content_encoding)
1858 function rg_process_input($content_length, $content_encoding, &$err)
1859 1859 { {
1860 $te = rg_var_str('HTTP_TRANSFER_ENCODING');
1861
1860 1862 rg_log_enter('DEBUG: process_input: cl=' . $content_length rg_log_enter('DEBUG: process_input: cl=' . $content_length
1861 . ' content_encoding=' . $content_encoding);
1863 . ' content_encoding=' . $content_encoding
1864 . ' te=' . $te);
1862 1865
1866 $ret = FALSE;
1863 1867 while (1) { while (1) {
1864 $ret = @file_get_contents('php://input');
1865 if (empty($ret)) {
1866 rg_log('DEBUG: php://input is empty!');
1867 $ret = FALSE;
1868 break;
1869 }
1868 $max_nice = ini_get('post_max_size');
1869 $max = rg_mega2bytes($max_nice);
1870 $max_nice = rg_1024($max);
1871 if ($content_length > $max) {
1872 $err = 'Your push size (' . rg_1024($content_length) . ')'
1873 . ' is bigger than the max allowed'
1874 . ' (' . $max_nice . ').' . "\n"
1875 . 'You may want to ask the admin to raise'
1876 . ' the limits (post_max_size).';
1877 break;
1878 }
1879
1880 if ($content_length == 0) {
1881 if (strcasecmp($te, 'chunked') != 0) {
1882 $err = 'No Content-Length header and'
1883 . ' Transfer-Encoding is not'
1884 . ' "chunked". Please let us know.';
1885 rg_internal_error($err);
1886 break;
1887 }
1888
1889 // TODO: Sadly, we are not able to do the streaming!
1890 // It is not available to php-fpm!
1870 1891
1871 if (0) { // maybe for nginx/lighttpd
1872 $f = @fopen('php://stdin', 'r');
1873 if ($f === FALSE) {
1874 rg_log('Cannot open stdin!');
1892 rg_git_info_pack("\x02", 'We could not process'
1893 . ' the data (chunked).');
1894
1895
1896 $err = 'You are trying to push chunked encoding data'
1897 . ' but php-fpm does not support it.' . "\n"
1898 . ' Try to run'
1899 . ' \'git config http.postBuffer 200000000\'.' . "\n"
1900 . ' The value must be bigger than what you'
1901 . ' want to push.';
1875 1902 break; break;
1876 }
1877 while (1) {
1878 $x = @fread($f, 4);
1879 if ($x === FALSE) {
1880 rg_log('DEBUG: cannot read!');
1903
1904 rg_log('DEBUG: have to read data from php://stdin');
1905 sleep(3);
1906 // 'stdin' is not good because fd0 is associated with /dev/null
1907 $f = @fopen('php://stdin', 'rb');
1908 $f2 = @fopen('php://input', 'rb');
1909 rg_log('DEBUG: f=' . $f . ' f2=' . $f2);
1910 if ($f === FALSE) {
1911 rg_log('Cannot open stdin!');
1881 1912 break; break;
1882 1913 } }
1883 rg_log('DEBUG: BLOCK: ' . $x);
1884 $ret = $x;
1885 break;
1886 }
1887 fclose($f);
1914 rg_log('DEBUG: start reading from php://stdin');
1915 while (1) {
1916 $x = @fread($f, 65536);
1917 rg_log('DEBUG: x=');
1918 if ($x === FALSE) {
1919 rg_log('DEBUG: cannot read!');
1920 break;
1921 }
1922 rg_log('DEBUG: BLOCK: ' . $x);
1923 $ret = $x;
1924 break;
1925 }
1926 fclose($f);
1927 } else { // Content-Length > 0
1928 // TODO: we should just pass the file descriptor
1929 // (with stream filter gzip if needed)
1930 // and not buffer the whole content.
1931 $ret = @file_get_contents('php://input');
1932 if (empty($ret)) {
1933 $err = 'No input provided. Please let us know.';
1934 rg_internal_error($err);
1935 $ret = FALSE;
1936 break;
1937 }
1938 rg_log('DEBUG: php://input returned ' . strlen($ret) . ' bytes');
1888 1939 } }
1889 1940
1890 1941 rg_log('DEBUG: data_in[0-31]: ' . substr($ret, 0, 32)); rg_log('DEBUG: data_in[0-31]: ' . substr($ret, 0, 32));
 
... ... function rg_user_http_git($db, $rg, $paras)
2086 2137
2087 2138 header('Content-Type: application/x-git-upload-pack-result'); header('Content-Type: application/x-git-upload-pack-result');
2088 2139
2089 // TODO: seems I cannot do this here -
2090 // seems remote receive-pack expects ACK/NAK first:
2140 // TODO: seems I cannot do this here:
2141 // remote receive-pack expects ACK/NAK first:
2091 2142 // fatal: git fetch_pack: expected ACK/NAK, got '... // fatal: git fetch_pack: expected ACK/NAK, got '...
2143 // Should I send NAK first?
2092 2144 /* /*
2093 2145 rg_git_info_pack("\x02", '== Welcome to RocketGit! =='); rg_git_info_pack("\x02", '== Welcome to RocketGit! ==');
2094 2146 rg_git_info_pack("\x02", 'you are connecting from IP ' rg_git_info_pack("\x02", 'you are connecting from IP '
 
... ... function rg_user_http_git($db, $rg, $paras)
2101 2153 */ */
2102 2154
2103 2155 $data_in = rg_process_input($content_length, $data_in = rg_process_input($content_length,
2104 $content_encoding);
2156 $content_encoding, $err);
2105 2157 if ($data_in === FALSE) if ($data_in === FALSE)
2106 2158 break; break;
2107 2159
 
... ... function rg_user_http_git($db, $rg, $paras)
2126 2178 . ' instead of ' . $host . '.'); . ' instead of ' . $host . '.');
2127 2179 putenv('ROCKETGIT_SHOW_INFO=0'); putenv('ROCKETGIT_SHOW_INFO=0');
2128 2180
2129 $max_nice = ini_get('post_max_size');
2130 $max = rg_mega2bytes($max_nice);
2131 $max_nice = rg_1024($max);
2132 $content_length = 1000000000;
2133 if ($content_length > $max) {
2134 rg_git_info_pack("\x02", 'Your push size ('
2135 . rg_1024($content_length) . ')'
2136 . ' is bigger than the'
2137 . ' max allowed (' . $max_nice . ').');
2138 rg_git_info_pack("\x02", 'You may want to ask'
2139 . ' the admin to raise the limit.');
2140 echo rg_git_flush();
2141 break;
2142 }
2143
2144 2181 $data_in = rg_process_input($content_length, $data_in = rg_process_input($content_length,
2145 $content_encoding);
2182 $content_encoding, $err);
2146 2183 if ($data_in === FALSE) { if ($data_in === FALSE) {
2147 2184 // We have to send '200'. // We have to send '200'.
2148 2185 // Else, we cannot send the hints // Else, we cannot send the hints
2149 2186 header($protocol . ' 200 Service unavailable'); header($protocol . ' 200 Service unavailable');
2150 rg_git_info_pack("\x02", 'We could not process'
2151 . ' the data (chunked).');
2152 rg_git_info_pack("\x02", 'Try to run \'git'
2153 . ' config http.postBuffer 200000000\'.');
2154 rg_git_info_pack("\x02", 'The value must be'
2155 . ' bigger than the biggest file pushed.');
2187 rg_git_info_pack("\x02", $err);
2156 2188 echo rg_git_flush(); echo rg_git_flush();
2157 2189 break; break;
2158 2190 } }
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://rocketgit.com/user/catalinux/rocketgit

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/catalinux/rocketgit

Clone this repository using git:
git clone git://git.rocketgit.com/user/catalinux/rocketgit

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