You are viewing a plain text version of this content. The canonical link for it is here.
Posted to websh-cvs@tcl.apache.org by ro...@apache.org on 2002/03/06 18:45:56 UTC

cvs commit: tcl-websh/src/generic response_ap.c

ronnie      02/03/06 09:45:55

  Modified:    src/generic response_ap.c
  Log:
  - fixed sending of multiple headers
  
  Revision  Changes    Path
  1.5       +27 -24    tcl-websh/src/generic/response_ap.c
  
  Index: response_ap.c
  ===================================================================
  RCS file: /home/cvs/tcl-websh/src/generic/response_ap.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- response_ap.c	26 Feb 2002 17:07:25 -0000	1.4
  +++ response_ap.c	6 Mar 2002 17:45:55 -0000	1.5
  @@ -9,7 +9,7 @@
    * See the file "license.terms" for information on usage and
    * redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.
    *
  - * @(#) $Id: response_ap.c,v 1.4 2002/02/26 17:07:25 hefti Exp $
  + * @(#) $Id: response_ap.c,v 1.5 2002/03/06 17:45:55 ronnie Exp $
    *
    */
   
  @@ -85,33 +85,36 @@
   			return TCL_ERROR;
   		    }
   
  -		    /* fixme
  -		     *
  -		     * use ap_table_set unless web::response -count key is > 1
  -		     * then use set for the first and add for the others.
  -		     */
  -
  -		    for (i = 0; i < lobjc; i++) {
  -		      if (strcasecmp(key, "Content-Type") == 0) {
  +		    if (lobjc) {
   #ifndef APACHE2
  -			    r->content_type =
  -				ap_pstrdup(r->pool, Tcl_GetString(lobjv[i]));
  +		      if (strcasecmp(key, "Content-Type") == 0) {
  +			r->content_type =
  +			  ap_pstrdup(r->pool, Tcl_GetString(lobjv[0]));
  +		      } else {
  +			ap_table_set(r->headers_out,
  +				     key,
  +				     Tcl_GetString(lobjv[0]));
  +			for (i = 1; i < lobjc; i++) {
  +			  ap_table_add(r->headers_out,
  +				       key,
  +				       Tcl_GetString(lobjv[i]));
   			}
  -			else {
  -			    ap_table_add(r->headers_out,
  -					 key,
  -					 Tcl_GetString(lobjv[i]));
  +		      }
   #else /* APACHE2 */
  -			    r->content_type =
  -				(char *) apr_pstrdup(r->pool,
  -						     Tcl_GetString(lobjv[i]));
  +		      if (strcasecmp(key, "Content-Type") == 0) {
  +			r->content_type =
  +			  (char *) apr_pstrdup(r->pool, Tcl_GetString(lobjv[0]));
  +		      } else {
  +			apr_table_set(r->headers_out,
  +				      key,
  +				      Tcl_GetString(lobjv[0]));
  +			for (i = 1; i < lobjc; i++) {
  +			  apr_table_add(r->headers_out,
  +					key,
  +					Tcl_GetString(lobjv[i]));
   			}
  -			else {
  -			    apr_table_add(r->headers_out,
  -					  key,
  -					  Tcl_GetString(lobjv[i]));
  +		      }
   #endif /* APACHE2 */
  -			}
   		    }
   		}
   	    }
  @@ -119,7 +122,7 @@
   #ifndef APACHE2
   	ap_send_http_header(r);
   #else /* APACHE2 */
  -	/* fixme: ap 2.0 API might change this call ? */
  +	/* fixme: wher is this call in ap 2.0 API? */
   	/* ap_send_http_header(r); */
   #endif /* APACHE2 */
   	responseObj->sendHeader = 0;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: websh-cvs-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-cvs-help@tcl.apache.org