cvs commit: apache/src CHANGES mod_negotiation.c

1997-06-26 Thread Dean Gaudet
dgaudet 97/06/26 19:20:21

  Modified:src   Tag: APACHE_1_2_X  CHANGES mod_negotiation.c
  Log:
  PR#94: Content negot fails unless each varient has a charset
  
  Reviewed by:  Dean, Alexei
  Submitted by: Paul Sutton
  
  Revision  ChangesPath
  No   revision
  
  
  No   revision
  
  
  1.286.2.11 +4 -0  apache/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /export/home/cvs/apache/src/CHANGES,v
  retrieving revision 1.286.2.10
  retrieving revision 1.286.2.11
  diff -C3 -r1.286.2.10 -r1.286.2.11
  *** CHANGES   1997/06/27 02:15:05 1.286.2.10
  --- CHANGES   1997/06/27 02:20:18 1.286.2.11
  ***
  *** 1,4 
  --- 1,8 
Changes with Apache 1.2.1
  +   
  +   *) If an object has multiple variants that are otherwise equal Apache
  +  would prefer the last listed variant rather than the first.
  +  [Paul Sutton] PR#94

  *) "HostnameLookups" now defaults to off because it is far better for
 the net if we require people that actually need this data to
  
  
  
  1.40.2.1  +19 -11apache/src/mod_negotiation.c
  
  Index: mod_negotiation.c
  ===
  RCS file: /export/home/cvs/apache/src/mod_negotiation.c,v
  retrieving revision 1.40
  retrieving revision 1.40.2.1
  diff -C3 -r1.40 -r1.40.2.1
  *** mod_negotiation.c 1997/04/17 02:50:20 1.40
  --- mod_negotiation.c 1997/06/27 02:20:19 1.40.2.1
  ***
  *** 642,658 
return cp;
}

  ! int read_type_map (negotiation_state *neg, char *map_name)
{
request_rec *r = neg->r;
  ! FILE *map = pfopen (neg->pool, map_name, "r");
  ! 
char buffer[MAX_STRING_LEN];
enum header_state hstate;
struct var_rec mime_info;

if (map == NULL) {
  ! log_reason("cannot access type map file", map_name, r);
return FORBIDDEN;
}

  --- 642,661 
return cp;
}

  ! static int read_type_map (negotiation_state *neg, request_rec *rr)
{
request_rec *r = neg->r;
  ! FILE *map;
char buffer[MAX_STRING_LEN];
enum header_state hstate;
struct var_rec mime_info;

  + if (rr->status != HTTP_OK) {
  + return rr->status;
  + }
  + map = pfopen (neg->pool, rr->filename, "r");
if (map == NULL) {
  ! log_reason("cannot access type map file", rr->filename, r);
return FORBIDDEN;
}

  ***
  *** 780,786 
closedir(dirp);

neg->avail_vars->nelts = 0;
  ! return read_type_map (neg, sub_req->filename);
}

/* Have reasonable variant --- gather notes.
  --- 783,789 
closedir(dirp);

neg->avail_vars->nelts = 0;
  ! return read_type_map (neg, sub_req);
}

/* Have reasonable variant --- gather notes.
  ***
  *** 1439,1446 
/* If the best variant's charset is ISO-8859-1 and this variant has
   the same charset quality, then we prefer this variant */
if (variant->charset_quality == best->charset_quality &&
  ! (best->content_charset == NULL || *best->content_charset == 0 ||
  ! strcmp(best->content_charset, "iso-8859-1") == 0)) {
*p_bestq = q;
return 1;
}
  --- 1442,1452 
/* If the best variant's charset is ISO-8859-1 and this variant has
   the same charset quality, then we prefer this variant */
if (variant->charset_quality == best->charset_quality &&
  ! (variant->content_charset != NULL &&
  !  strcmp(variant->content_charset, "iso-8859-1") != 0) &&
  ! (best->content_charset == NULL ||
  !  *best->content_charset == '\0' ||
  !  strcmp(best->content_charset, "iso-8859-1") == 0)) {
*p_bestq = q;
return 1;
}
  ***
  *** 1538,1546 
/* If the best variant's charset is ISO-8859-1 and this variant has
   the same charset quality, then we prefer this variant */
if (variant->charset_quality > best->charset_quality ||
  ! (variant->charset_quality == best->charset_quality &&
  ! (best->content_charset == NULL || *best->content_charset == 0 ||
  ! strcmp(best->content_charset, "iso-8859-1") == 0))) {
*p_bestq = q;
return 1;
}
  --- 1544,1554 
/* If the best variant's charset is ISO-8859-1 and this variant has
   the same charset quality, then we prefer this variant */
if (variant->charset_quality > best->charset_quality ||
  ! ((variant->content_charset != NULL &&
  !   strcmp(variant->content_charset, "iso-8859-1") != 0) &&
 

cvs commit: apache/src CHANGES mod_negotiation.c

1997-04-16 Thread Dean Gaudet
dgaudet 97/04/16 19:50:21

  Modified:src   CHANGES mod_negotiation.c
  Log:
  Promote per_dir_config and subprocess_env from subrequest to main request.
  Fixes a problem where  sections weren't properly applied to negotiated
  content.
  
  Reviewed by:  Roy, Randy
  
  Revision  ChangesPath
  1.235 +5 -0  apache/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /export/home/cvs/apache/src/CHANGES,v
  retrieving revision 1.234
  retrieving revision 1.235
  diff -C3 -r1.234 -r1.235
  *** CHANGES   1997/04/16 06:07:43 1.234
  --- CHANGES   1997/04/17 02:50:19 1.235
  ***
  *** 1,5 
  --- 1,10 
Changes with Apache 1.2

  +   *) Promote per_dir_config and subprocess_env from the subrequest to the
  +  main request in mod_negotiation.  In particular this fixes a bug
  +  where  sections wouldn't properly apply to negotiated content.
  +  [Dean Gaudet]
  + 
  *) Updated mod_rewrite to 3.0.4: Fixes HTTP redirects from within
 .htaccess files because the RewriteBase was not replaced correctly.
 [Ralf S. Engelschall]
  
  
  
  1.40  +3 -0  apache/src/mod_negotiation.c
  
  Index: mod_negotiation.c
  ===
  RCS file: /export/home/cvs/apache/src/mod_negotiation.c,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -C3 -r1.39 -r1.40
  *** mod_negotiation.c 1997/04/07 10:19:31 1.39
  --- mod_negotiation.c 1997/04/17 02:50:20 1.40
  ***
  *** 1996,2007 
  --- 1996,2010 
r->content_languages = sub_req->content_languages;
r->content_language = sub_req->content_language;
r->finfo = sub_req->finfo;
  + r->per_dir_config = sub_req->per_dir_config;
/* copy output headers from subrequest, but leave negotiation headers */
r->notes = overlay_tables(r->pool, sub_req->notes, r->notes);
r->headers_out = overlay_tables(r->pool, sub_req->headers_out,
 r->headers_out);
r->err_headers_out = overlay_tables(r->pool, sub_req->err_headers_out,
 r->err_headers_out);
  + r->subprocess_env = overlay_tables(r->pool, sub_req->subprocess_env,
  + r->subprocess_env);
avail_recs = (var_rec *)neg->avail_vars->elts;
for (j = 0; j < neg->avail_vars->nelts; ++j) {
var_rec *variant = &avail_recs[j];
  
  
  


cvs commit: apache/src CHANGES mod_negotiation.c

1997-04-07 Thread Roy Fielding
fielding97/04/07 03:19:32

  Modified:src   CHANGES mod_negotiation.c
  Log:
  Use err_headers_out for Vary and Alternates, since the new
  send_http_header() now sends them for all responses.
  
  Submitted by: Petr Lampa
  Reviewed by: Roy Fielding, Dean Gaudet
  
  Revision  ChangesPath
  1.224 +3 -0  apache/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /export/home/cvs/apache/src/CHANGES,v
  retrieving revision 1.223
  retrieving revision 1.224
  diff -C3 -r1.223 -r1.224
  *** CHANGES   1997/04/07 09:59:49 1.223
  --- CHANGES   1997/04/07 10:19:30 1.224
  ***
  *** 48,53 
  --- 48,56 
 ensure that the server-reserved fields are not being overridden,
 while not overriding those that are not reserved.  [Roy Fielding]

  +   *) Moved transparent content negotiation fields to err_headers_out
  +  to reflect above changes.  [Petr Lampa]
  + 
  *) Fixed the determination of whether or not we should make the
 connection persistent for all of the cases where some other part
 of the server has already indicated that we should not.  Also
  
  
  
  1.39  +8 -17 apache/src/mod_negotiation.c
  
  Index: mod_negotiation.c
  ===
  RCS file: /export/home/cvs/apache/src/mod_negotiation.c,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -C3 -r1.38 -r1.39
  *** mod_negotiation.c 1997/04/01 05:41:44 1.38
  --- mod_negotiation.c 1997/04/07 10:19:31 1.39
  ***
  *** 1663,1680 
int vary_by_encoding = 0;
array_header *hdrs;

  ! /* This is a bit of a hack: the apache status handling code regards
  !  * any status other than 200 as an error, and only outputs
  !  * headers marked as safe for output with errors. This
  !  * are the header stored in err_headers_out. If we know
  !  * we are going to generate a 300 status (because we got
  !  * a network-algorithm result of na_list), we put these
  !  * headers into err_headers_out to get them output with the
  !  * list response. The core code which handles error responses
  !  * should really be updated, since these headers should probably
  !  * be output for other 2xx and 3xx statuses as well.
  !  */
  ! hdrs = (na_result == na_list) ? r->err_headers_out : r->headers_out;

for (j = 0; j < neg->avail_vars->nelts; ++j) {

  --- 1663,1671 
int vary_by_encoding = 0;
array_header *hdrs;

  ! /* Put headers into err_headers_out, new send_http_header()
  !  * outputs both headers_out and err_headers_out */
  ! hdrs = r->err_headers_out;

for (j = 0; j < neg->avail_vars->nelts; ++j) {

  ***
  *** 1832,1844 
 */

if ((sub_req->status == HTTP_MULTIPLE_CHOICES) ||
  ! (table_get(sub_req->headers_out, "Alternates")) ||
  ! (table_get(sub_req->headers_out, "Content-Location")))
return VARIANT_ALSO_VARIES;

  ! if ((sub_vary = table_get(sub_req->headers_out, "Vary")) != NULL)
  ! table_set(r->headers_out, "Variant-Vary", sub_vary);
  ! table_set(r->headers_out, "Content-Location", variant->file_name);
set_neg_headers(r, neg, na_choice); /* add Alternates and Vary */
/* to do: add Expires */

  --- 1823,1835 
 */

if ((sub_req->status == HTTP_MULTIPLE_CHOICES) ||
  ! (table_get(sub_req->err_headers_out, "Alternates")) ||
  ! (table_get(sub_req->err_headers_out, "Content-Location")))
return VARIANT_ALSO_VARIES;

  ! if ((sub_vary = table_get(sub_req->err_headers_out, "Vary")) != NULL)
  ! table_set(r->err_headers_out, "Variant-Vary", sub_vary);
  ! table_set(r->err_headers_out, "Content-Location", variant->file_name);
set_neg_headers(r, neg, na_choice); /* add Alternates and Vary */
/* to do: add Expires */

  
  
  


cvs commit: apache/src CHANGES mod_negotiation.c

1997-03-31 Thread Roy Fielding
fielding97/03/31 21:41:46

  Modified:src   CHANGES mod_negotiation.c
  Log:
  Petr's patch to merge r->notes, r->headers_out and r->err_headers_out
  didn't call overlay_tables properly.  This is the only bug fix.
  The other hunks are more destroy_sub_req()s that are similar to the other
  cleanups that Petr's patch performed.
  
  Submitted by: Dean Gaudet
  Reviewed by: Roy Fielding, Chuck Murcko
  
  Revision  ChangesPath
  1.218 +3 -0  apache/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /export/home/cvs/apache/src/CHANGES,v
  retrieving revision 1.217
  retrieving revision 1.218
  diff -C3 -r1.217 -r1.218
  *** CHANGES   1997/04/01 05:04:24 1.217
  --- CHANGES   1997/04/01 05:41:43 1.218
  ***
  *** 77,82 
  --- 77,85 
 no variants found; Add handling of '*' wildcard in Accept-Charset.
 [Petr Lampa and Paul Sutton]

  +   *) Fixed overlaying of request/sub-request notes and headers in
  +  mod_negotiation.  [Dean Gaudet]
  + 
  *) If two variants' charset quality are equal and one is the default
 charset (iso-8859-1), then prefer the variant that was specifically
 listed in Accept-Charset instead of the default.  [Petr Lampa]
  
  
  
  1.38  +17 -6 apache/src/mod_negotiation.c
  
  Index: mod_negotiation.c
  ===
  RCS file: /export/home/cvs/apache/src/mod_negotiation.c,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -C3 -r1.37 -r1.38
  *** mod_negotiation.c 1997/03/24 22:07:06 1.37
  --- mod_negotiation.c 1997/04/01 05:41:44 1.38
  ***
  *** 764,770 
if (sub_req->handler && !sub_req->content_type)
  sub_req->content_type = CGI_MAGIC_TYPE;

  ! if (sub_req->status != HTTP_OK || !sub_req->content_type) continue;

/* If it's a map file, we use that instead of the map
 * we're building...
  --- 764,773 
if (sub_req->handler && !sub_req->content_type)
  sub_req->content_type = CGI_MAGIC_TYPE;

  ! if (sub_req->status != HTTP_OK || !sub_req->content_type) {
  ! destroy_sub_req(sub_req);
  ! continue;
  ! }

/* If it's a map file, we use that instead of the map
 * we're building...
  ***
  *** 1806,1814 
char *sub_vary;

if (!variant->sub_req) {
sub_req = sub_req_lookup_file(variant->file_name, r);
  ! if (sub_req->status != HTTP_OK && sub_req->status != 
HTTP_MULTIPLE_CHOICES)
  ! return sub_req->status;
variant->sub_req = sub_req;
}
else 
  --- 1809,1822 
char *sub_vary;

if (!variant->sub_req) {
  + int status;
  + 
sub_req = sub_req_lookup_file(variant->file_name, r);
  ! status = sub_req->status;
  ! if (status != HTTP_OK && status != HTTP_MULTIPLE_CHOICES) {
  ! destroy_sub_req(sub_req);
  ! return status;
  ! }
variant->sub_req = sub_req;
}
else 
  ***
  *** 1970,1975 
  --- 1978,1984 
sub_req = sub_req_lookup_file (best->file_name, r);
if (sub_req->status != HTTP_OK) {
   res = sub_req->status;
  +destroy_sub_req(sub_req);
   goto return_from_multi;
}
}
  ***
  *** 1997,2005 
r->content_language = sub_req->content_language;
r->finfo = sub_req->finfo;
/* copy output headers from subrequest, but leave negotiation headers */
  ! overlay_tables(r->pool, sub_req->notes, r->notes);
  ! overlay_tables(r->pool, sub_req->headers_out, r->headers_out);
  ! overlay_tables(r->pool, sub_req->err_headers_out, r->err_headers_out);
avail_recs = (var_rec *)neg->avail_vars->elts;
for (j = 0; j < neg->avail_vars->nelts; ++j) {
var_rec *variant = &avail_recs[j];
  --- 2006,2016 
r->content_language = sub_req->content_language;
r->finfo = sub_req->finfo;
/* copy output headers from subrequest, but leave negotiation headers */
  ! r->notes = overlay_tables(r->pool, sub_req->notes, r->notes);
  ! r->headers_out = overlay_tables(r->pool, sub_req->headers_out,
  !  r->headers_out);
  ! r->err_headers_out = overlay_tables(r->pool, sub_req->err_headers_out,
  !  r->err_headers_out);
avail_recs = (var_rec *)neg->avail_vars->elts;
for (j = 0; j < neg->avail_vars->nelts; ++j) {
var_rec *variant = &avail_recs[j];
  
  
  


cvs commit: apache/src CHANGES mod_negotiation.c

1997-03-24 Thread Roy Fielding
fielding97/03/24 14:07:08

  Modified:src   CHANGES mod_negotiation.c
  Log:
  If charset quality of current variant and best variant is equal
  and the best variant is in ISO-8859-1, then prefer current variant.
  
  Submitted by: Petr Lampa
  Reviewed by: Roy Fielding and Dean Gaudet
  
  Revision  ChangesPath
  1.210 +5 -2  apache/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /export/home/cvs/apache/src/CHANGES,v
  retrieving revision 1.209
  retrieving revision 1.210
  diff -C3 -r1.209 -r1.210
  *** CHANGES   1997/03/22 23:51:00 1.209
  --- CHANGES   1997/03/24 22:07:05 1.210
  ***
  *** 56,68 
  *) Try to continue gracefully by disabling the vhost if a DNS lookup
 fails while parsing the configuration file.  [Dean Gaudet]

  !   *) Workaround to a compiler bug that causes SunOS 4.1.x to panic.
  !  [Roy Fielding]

  *) Negotiation changes: Don't output empty content-type in variant list;
 Output charset in variant list; Return sooner from handle_multi() if
 no variants found; Add handling of '*' wildcard in Accept-Charset.
 [Petr Lampa and Paul Sutton]

  *) Memory allocation problem in push_array() -- it would corrupt memory
 when nalloc==0.  [Kai Risku <[EMAIL PROTECTED]> and Roy Fielding]
  --- 56,71 
  *) Try to continue gracefully by disabling the vhost if a DNS lookup
 fails while parsing the configuration file.  [Dean Gaudet]

  !   *) Improved calls to setsockopt.  [Roy Fielding]

  *) Negotiation changes: Don't output empty content-type in variant list;
 Output charset in variant list; Return sooner from handle_multi() if
 no variants found; Add handling of '*' wildcard in Accept-Charset.
 [Petr Lampa and Paul Sutton]
  + 
  +   *) If two variants' charset quality are equal and one is the default
  +  charset (iso-8859-1), then prefer the variant that was specifically
  +  listed in Accept-Charset instead of the default.  [Petr Lampa]

  *) Memory allocation problem in push_array() -- it would corrupt memory
 when nalloc==0.  [Kai Risku <[EMAIL PROTECTED]> and Roy Fielding]
  
  
  
  1.37  +16 -1 apache/src/mod_negotiation.c
  
  Index: mod_negotiation.c
  ===
  RCS file: /export/home/cvs/apache/src/mod_negotiation.c,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -C3 -r1.36 -r1.37
  *** mod_negotiation.c 1997/03/18 09:46:28 1.36
  --- mod_negotiation.c 1997/03/24 22:07:06 1.37
  ***
  *** 1432,1437 
  --- 1432,1447 
*p_bestq = q;
return 1;
}
  + if (q == bestq) {   
  + /* If the best variant's charset is ISO-8859-1 and this variant has
  +the same charset quality, then we prefer this variant */
  + if (variant->charset_quality == best->charset_quality &&
  + (best->content_charset == NULL || *best->content_charset == 0 ||
  + strcmp(best->content_charset, "iso-8859-1") == 0)) {
  + *p_bestq = q;
  + return 1;
  + }
  + }
return 0;
}

  ***
  *** 1522,1528 
/* charset */
if (variant->charset_quality < best->charset_quality)
return 0;
  ! if (variant->charset_quality > best->charset_quality) {
*p_bestq = q;
return 1;
}
  --- 1532,1543 
/* charset */
if (variant->charset_quality < best->charset_quality)
return 0;
  ! /* If the best variant's charset is ISO-8859-1 and this variant has
  !the same charset quality, then we prefer this variant */
  ! if (variant->charset_quality > best->charset_quality ||
  ! (variant->charset_quality == best->charset_quality &&
  ! (best->content_charset == NULL || *best->content_charset == 0 ||
  ! strcmp(best->content_charset, "iso-8859-1") == 0))) {
*p_bestq = q;
return 1;
}
  
  
  


cvs commit: apache/src CHANGES mod_negotiation.c

1997-03-13 Thread Roy Fielding
fielding97/03/13 19:27:34

  Modified:src   CHANGES mod_negotiation.c
  Log:
  Negotiation changes: Don't output empty content-type in variant list;
  Output charset in variant list; Return sooner from handle_multi() if
  no variants found; Add handling of '*' wildcard in Accept-Charset.
  
  Submitted by: Petr Lampa and Paul Sutton
  Reviewed by: Roy Fielding, Jim Jagielski
  
  Revision  ChangesPath
  1.197 +5 -0  apache/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /export/home/cvs/apache/src/CHANGES,v
  retrieving revision 1.196
  retrieving revision 1.197
  diff -C3 -r1.196 -r1.197
  *** CHANGES   1997/03/11 06:04:38 1.196
  --- CHANGES   1997/03/14 03:27:31 1.197
  ***
  *** 1,5 
  --- 1,10 
Changes with Apache 1.2b8

  +   *) Negotiation changes: Don't output empty content-type in variant list;
  +  Output charset in variant list; Return sooner from handle_multi() if
  +  no variants found; Add handling of '*' wildcard in Accept-Charset.
  +  [Petr Lampa and Paul Sutton]
  + 
  *) Memory allocation problem in push_array() -- it would corrupt memory
 when nalloc==0.  [Kai Risku <[EMAIL PROTECTED]> and Roy Fielding]

  
  
  
  1.35  +23 -14apache/src/mod_negotiation.c
  
  Index: mod_negotiation.c
  ===
  RCS file: /export/home/cvs/apache/src/mod_negotiation.c,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -C3 -r1.34 -r1.35
  *** mod_negotiation.c 1997/03/07 14:15:43 1.34
  --- mod_negotiation.c 1997/03/14 03:27:32 1.35
  ***
  *** 1274,1291 
int i;
accept_rec *accept_recs = (accept_rec *)neg->accept_charsets->elts;
char *charset = variant->content_charset;
  ! 
  ! if (!charset)
  ! return; /* variant has no charset */

/* if no Accept-Charset: header, leave quality alone (will
 * remain at the default value of 1) */
if (!neg->accept_charsets || neg->accept_charsets->nelts == 0) 
return;

  ! if (!*charset || !strcmp(charset, "iso-8859-1"))
  ! return; /* default charset always ok */
  ! 

/*
 * Go through each of the items on the Accept-Charset: header,
  --- 1274,1287 
int i;
accept_rec *accept_recs = (accept_rec *)neg->accept_charsets->elts;
char *charset = variant->content_charset;
  ! accept_rec *star = NULL;

/* if no Accept-Charset: header, leave quality alone (will
 * remain at the default value of 1) */
if (!neg->accept_charsets || neg->accept_charsets->nelts == 0) 
return;

  ! if (charset == NULL || !*charset) charset = "iso-8859-1";

/*
 * Go through each of the items on the Accept-Charset: header,
  ***
  *** 1299,1307 
if (!strcmp(type->type_name, charset)) {
variant->charset_quality = type->quality;
return;
}
}
  ! variant->charset_quality = 0.0;
}

/* For a given variant, find the best matching Accept: header
  --- 1295,1316 
if (!strcmp(type->type_name, charset)) {
variant->charset_quality = type->quality;
return;
  + } else
  + if (strcmp(type->type_name, "*") == 0) {
  + star = type;
}
}
  ! /* No explicit match */
  ! if (star) {
  ! variant->charset_quality = star->quality;
  ! return;
  ! }
  ! /* If this variant is in charset iso-8859-1, the default is 1.0 */
  ! if (strcmp(charset, "iso-8859-1") == 0) {
  ! variant->charset_quality = 1.0;
  ! } else {
  ! variant->charset_quality = 0.0;
  ! }
}

/* For a given variant, find the best matching Accept: header
  ***
  *** 1737,1743 
for (i = 0; i < neg->avail_vars->nelts; ++i) {
var_rec *variant = &((var_rec *)neg->avail_vars->elts)[i];
char *filename = variant->file_name ? variant->file_name : "";
  - char *content_type = variant->type_name ? variant->type_name : "";
array_header *languages = variant->content_languages;
char *description = variant->description ? variant->description : 
"";

  --- 1746,1751 
  ***
  *** 1746,1757 
 * 'English'). */
t = pstrcat(r->pool, t, "", 
filename, " ", description, NULL);
  ! if (content_type)
  ! t = pstrcat(r->pool, t, " type ", content_type, NULL);
if (languages && languages->nelts)
  ! t = pstrcat(r->pool, t, " language ",
merge_string_array(r->pool, languages, ", "),
NULL);
t = pstrcat(r->pool

cvs commit: apache/src CHANGES mod_negotiation.c

1997-02-21 Thread Randy Terbush
randy   97/02/21 16:33:32

  Modified:src   CHANGES mod_negotiation.c
  Log:
  - replace protocol response numbers with symbols
  - save variant-list into main request notes
  - free allocated memory from subrequests
  - merge notes, headers_out and err_headers_out
  Reviewed by:  Dean Gaudet, Randy Terbush, Marc Slemko
  Submitted by: Petr Lampa
  
  Revision  ChangesPath
  1.178 +6 -0  apache/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /export/home/cvs/apache/src/CHANGES,v
  retrieving revision 1.177
  retrieving revision 1.178
  diff -C3 -r1.177 -r1.178
  *** CHANGES   1997/02/21 01:20:39 1.177
  --- CHANGES   1997/02/22 00:33:29 1.178
  ***
  *** 1,5 
  --- 1,11 
Changes with Apache 1.2b7

  +   *) mod_negotiation fixes [Petr Lampa]
  +  - replace protocol response numbers with symbols
  +  - save variant-list into main request notes
  +  - free allocated memory from subrequests
  +  - merge notes, headers_out and err_headers_out
  + 
  *) changed status check mask in proxy_http.c from "HTTP/#.# ### *" to
 "HTTP/#.# ###*" to be more lenient about what we accept.
 [Chuck Murcko]
  
  
  
  1.33  +49 -14apache/src/mod_negotiation.c
  
  Index: mod_negotiation.c
  ===
  RCS file: /export/home/cvs/apache/src/mod_negotiation.c,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -C3 -r1.32 -r1.33
  *** mod_negotiation.c 1997/02/07 07:13:15 1.32
  --- mod_negotiation.c 1997/02/22 00:33:29 1.33
  ***
  *** 763,769 
if (sub_req->handler && !sub_req->content_type)
  sub_req->content_type = CGI_MAGIC_TYPE;

  ! if (sub_req->status != 200 || !sub_req->content_type) continue;

/* If it's a map file, we use that instead of the map
 * we're building...
  --- 763,769 
if (sub_req->handler && !sub_req->content_type)
  sub_req->content_type = CGI_MAGIC_TYPE;

  ! if (sub_req->status != HTTP_OK || !sub_req->content_type) continue;

/* If it's a map file, we use that instead of the map
 * we're building...
  ***
  *** 1761,1767 

void store_variant_list (request_rec *r, negotiation_state *neg)
{
  !   table_set (r->notes, "variant-list", make_variant_list (r, neg));
}

/* Called if we got a "Choice" response from the network algorithm.
  --- 1761,1771 

void store_variant_list (request_rec *r, negotiation_state *neg)
{
  !   if (r->main == NULL) {
  !  table_set (r->notes, "variant-list", make_variant_list (r, neg));
  !   } else {
  !  table_set (r->main->notes, "variant-list", make_variant_list (r->main, 
neg));
  !   }
}

/* Called if we got a "Choice" response from the network algorithm.
  ***
  *** 1777,1783 

if (!variant->sub_req) {
sub_req = sub_req_lookup_file(variant->file_name, r);
  ! if (sub_req->status != 200 && sub_req->status != 300)
return sub_req->status;
variant->sub_req = sub_req;
}
  --- 1781,1787 

if (!variant->sub_req) {
sub_req = sub_req_lookup_file(variant->file_name, r);
  ! if (sub_req->status != HTTP_OK && sub_req->status != 
HTTP_MULTIPLE_CHOICES)
return sub_req->status;
variant->sub_req = sub_req;
}
  ***
  *** 1793,1799 
 * the normal variant handling 
 */

  ! if ((sub_req->status == 300) ||
(table_get(sub_req->headers_out, "Alternates")) ||
(table_get(sub_req->headers_out, "Content-Location")))
return VARIANT_ALSO_VARIES;
  --- 1797,1803 
 * the normal variant handling 
 */

  ! if ((sub_req->status == HTTP_MULTIPLE_CHOICES) ||
(table_get(sub_req->headers_out, "Alternates")) ||
(table_get(sub_req->headers_out, "Content-Location")))
return VARIANT_ALSO_VARIES;
  ***
  *** 1870,1878 
int handle_multi (request_rec *r)
{
negotiation_state *neg;
  ! var_rec *best;
request_rec *sub_req;
int res;
int na_result;  /* result of network algorithm */

if (r->finfo.st_mode != 0 || !(allow_options (r) & OPT_MULTI))
  --- 1874,1883 
int handle_multi (request_rec *r)
{
negotiation_state *neg;
  ! var_rec *best, *avail_recs;
request_rec *sub_req;
int res;
  + int j;
int na_result;  /* result of network algorithm */

if (r->finfo.st_mode != 0 || !(allow_options (r) & OPT_MULTI))
  ***
  *** 1880,1893 

neg = parse_accept_headers (r);

  ! if ((res = read_types_multi (

cvs commit: apache/src CHANGES mod_negotiation.c

1997-02-06 Thread Marc Slemko
marc97/02/06 22:36:10

  Modified:src   CHANGES mod_negotiation.c
  Log:
  Fix handling of languages when lang_index == -1 in is_variant_better().
  Closes PR#155,94
  
  Submitted by: [EMAIL PROTECTED]
  Reviewed by: Paul Sutton, Marc Slemko, Dean Gaudet
  
  Revision  ChangesPath
  1.147 +4 -0  apache/src/CHANGES
  
  Index: CHANGES
  ===
  RCS file: /export/home/cvs/apache/src/CHANGES,v
  retrieving revision 1.146
  retrieving revision 1.147
  diff -C3 -r1.146 -r1.147
  *** CHANGES   1997/02/06 21:45:45 1.146
  --- CHANGES   1997/02/07 06:36:06 1.147
  ***
  *** 1,5 
  --- 1,9 
Changes with Apache 1.2b7

  +   *) Fix handling of lang_index in is_variant_better().  This was
  +  causing problems which resulted in the server sending the
  +  wrong language document in some cases.
  + 
  *) Remove free() from clean_env() in suexec wrapper. This was nuking
 the clean environment on some systems.

  
  
  
  1.31  +3 -2  apache/src/mod_negotiation.c
  
  Index: mod_negotiation.c
  ===
  RCS file: /export/home/cvs/apache/src/mod_negotiation.c,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -C3 -r1.30 -r1.31
  *** mod_negotiation.c 1997/01/20 04:28:15 1.30
  --- mod_negotiation.c 1997/02/07 06:36:07 1.31
  ***
  *** 1482,1490 

/* if language qualities were equal, try the LanguagePriority
 * stuff */
  ! if (variant->lang_index > best->lang_index)
return 0;
  ! if (variant->lang_index < best->lang_index) {
*p_bestq = q;
return 1;
}
  --- 1482,1491 

/* if language qualities were equal, try the LanguagePriority
 * stuff */
  ! if (best->lang_index != -1 && variant->lang_index > best->lang_index)
return 0;
  ! if (variant->lang_index != -1 &&
  ! (variant->lang_index < best->lang_index || best->lang_index == -1)) 
{
*p_bestq = q;
return 1;
}