Skip to content

Instantly share code, notes, and snippets.

@nijssen
Created April 20, 2015 07:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nijssen/cc6ed47668e6db64eefd to your computer and use it in GitHub Desktop.
Save nijssen/cc6ed47668e6db64eefd to your computer and use it in GitHub Desktop.
Installing Everything: Apache patch
diff -crB apache1/apache_1.3.9/src/main/http_protocol.c apache_1.3.9/src/main/http_protocol.c
*** apache1/apache_1.3.9/src/main/http_protocol.c 1999-08-14 02:21:19.000000000 -0700
--- apache_1.3.9/src/main/http_protocol.c 2015-04-12 19:08:54.437509643 -0700
***************
*** 659,665 ****
* then the actual input line exceeded the buffer length,
* and it would be a good idea for the caller to puke 400 or 414.
*/
! static int getline(char *s, int n, BUFF *in, int fold)
{
char *pos, next;
int retval;
--- 659,665 ----
* then the actual input line exceeded the buffer length,
* and it would be a good idea for the caller to puke 400 or 414.
*/
! static int getline2(char *s, int n, BUFF *in, int fold)
{
char *pos, next;
int retval;
***************
*** 784,790 ****
* have to block during a read.
*/
ap_bsetflag(conn->client, B_SAFEREAD, 1);
! while ((len = getline(l, sizeof(l), conn->client, 0)) <= 0) {
if ((len < 0) || ap_bgetflag(conn->client, B_EOF)) {
ap_bsetflag(conn->client, B_SAFEREAD, 0);
/* this is a hack to make sure that request time is set,
--- 784,790 ----
* have to block during a read.
*/
ap_bsetflag(conn->client, B_SAFEREAD, 1);
! while ((len = getline2(l, sizeof(l), conn->client, 0)) <= 0) {
if ((len < 0) || ap_bgetflag(conn->client, B_EOF)) {
ap_bsetflag(conn->client, B_SAFEREAD, 0);
/* this is a hack to make sure that request time is set,
***************
*** 855,861 ****
* Read header lines until we get the empty separator line, a read error,
* the connection closes (EOF), reach the server limit, or we timeout.
*/
! while ((len = getline(field, sizeof(field), c->client, 1)) > 0) {
if (r->server->limit_req_fields &&
(++fields_read > r->server->limit_req_fields)) {
--- 855,861 ----
* Read header lines until we get the empty separator line, a read error,
* the connection closes (EOF), reach the server limit, or we timeout.
*/
! while ((len = getline2(field, sizeof(field), c->client, 1)) > 0) {
if (r->server->limit_req_fields &&
(++fields_read > r->server->limit_req_fields)) {
***************
*** 1842,1848 ****
if (r->remaining == 0) { /* Start of new chunk */
! chunk_start = getline(buffer, bufsiz, r->connection->client, 0);
if ((chunk_start <= 0) || (chunk_start >= (bufsiz - 1))
|| !ap_isxdigit(*buffer)) {
r->connection->keepalive = -1;
--- 1842,1848 ----
if (r->remaining == 0) { /* Start of new chunk */
! chunk_start = getline2(buffer, bufsiz, r->connection->client, 0);
if ((chunk_start <= 0) || (chunk_start >= (bufsiz - 1))
|| !ap_isxdigit(*buffer)) {
r->connection->keepalive = -1;
***************
*** 1883,1889 ****
len_read = chunk_start;
while ((bufsiz > 1) && ((len_read =
! getline(buffer, bufsiz, r->connection->client, 1)) > 0)) {
if (len_read != (bufsiz - 1)) {
buffer[len_read++] = CR; /* Restore footer line end */
--- 1883,1889 ----
len_read = chunk_start;
while ((bufsiz > 1) && ((len_read =
! getline2(buffer, bufsiz, r->connection->client, 1)) > 0)) {
if (len_read != (bufsiz - 1)) {
buffer[len_read++] = CR; /* Restore footer line end */
Only in apache_1.3.9/src/modules: perl
diff -crB apache1/apache_1.3.9/src/support/htdigest.c apache_1.3.9/src/support/htdigest.c
*** apache1/apache_1.3.9/src/support/htdigest.c 1999-08-02 03:45:36.000000000 -0700
--- apache_1.3.9/src/support/htdigest.c 2015-04-18 17:09:12.680477754 -0700
***************
*** 108,114 ****
while ((line[y++] = line[x++]));
}
! static int getline(char *s, int n, FILE *f)
{
register int i = 0;
--- 108,114 ----
while ((line[y++] = line[x++]));
}
! static int getline2(char *s, int n, FILE *f)
{
register int i = 0;
***************
*** 236,242 ****
strcpy(realm, argv[2]);
found = 0;
! while (!(getline(line, MAX_STRING_LEN, f))) {
if (found || (line[0] == '#') || (!line[0])) {
putline(tfp, line);
continue;
--- 236,242 ----
strcpy(realm, argv[2]);
found = 0;
! while (!(getline2(line, MAX_STRING_LEN, f))) {
if (found || (line[0] == '#') || (!line[0])) {
putline(tfp, line);
continue;
diff -crB apache1/apache_1.3.9/src/support/htpasswd.c apache_1.3.9/src/support/htpasswd.c
*** apache1/apache_1.3.9/src/support/htpasswd.c 1999-08-12 07:15:22.000000000 -0700
--- apache_1.3.9/src/support/htpasswd.c 2015-04-18 17:08:50.096067830 -0700
***************
*** 123,129 ****
* Get a line of input from the user, not including any terminating
* newline.
*/
! static int getline(char *s, int n, FILE *f)
{
register int i = 0;
--- 123,129 ----
* Get a line of input from the user, not including any terminating
* newline.
*/
! static int getline2(char *s, int n, FILE *f)
{
register int i = 0;
***************
*** 519,525 ****
char scratch[MAX_STRING_LEN];
fpw = fopen(pwfilename, "r");
! while (! (getline(line, sizeof(line), fpw))) {
char *colon;
if ((line[0] == '#') || (line[0] == '\0')) {
--- 519,525 ----
char scratch[MAX_STRING_LEN];
fpw = fopen(pwfilename, "r");
! while (! (getline2(line, sizeof(line), fpw))) {
char *colon;
if ((line[0] == '#') || (line[0] == '\0')) {
diff -crB apache1/apache_1.3.9/src/support/logresolve.c apache_1.3.9/src/support/logresolve.c
*** apache1/apache_1.3.9/src/support/logresolve.c 1998-07-13 04:32:58.000000000 -0700
--- apache_1.3.9/src/support/logresolve.c 2015-04-18 17:09:25.803972708 -0700
***************
*** 49,55 ****
#endif
static void cgethost(struct in_addr ipnum, char *string, int check);
! static int getline(char *s, int n);
static void stats(FILE *output);
--- 49,55 ----
#endif
static void cgethost(struct in_addr ipnum, char *string, int check);
! static int getline2(char *s, int n);
static void stats(FILE *output);
***************
*** 256,262 ****
* gets a line from stdin
*/
! static int getline (char *s, int n)
{
char *cp;
--- 256,262 ----
* gets a line from stdin
*/
! static int getline2 (char *s, int n)
{
char *cp;
***************
*** 299,305 ****
for (i = 0; i < MAX_ERR + 2; i++)
errors[i] = 0;
! while (getline(line, MAXLINE)) {
if (line[0] == '\0')
continue;
entries++;
--- 299,305 ----
for (i = 0; i < MAX_ERR + 2; i++)
errors[i] = 0;
! while (getline2(line, MAXLINE)) {
if (line[0] == '\0')
continue;
entries++;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment