Bug#511878: apache2-mpm-prefork: The httpd server runs inside an artificial LANG=C environment

2009-01-15 Thread Josef Spillner
Package: apache2-mpm-prefork
Version: 2.2.9-10+lenny1
Severity: normal

Running Apache with mod_dav and mod_svn gave me the infamous:
  svn: Can't convert string from 'UTF-8' to native encoding:
when trying to access an SVN directory deliberately created with cyrillic 
letters in UTF-8 encoding. This made me wonder why, since my $LANG and the 
system $LANG (through /etc/environment) is set to de_DE.UTF-8. Even when 
running
  /etc/init.d/apache start
from the interactive console, the LANG value in /proc/apachemainpid/environ 
was set to C. Neither in the startup scripts nor in the httpd sources I can 
find any reference to this, therefore this report comes without patches, 
unfortunately. A workaround is adding LANG=de_DE.UTF-8 to 
/etc/apache2/envvars, but this should hardly be necessary when looking at the 
lenny release goal of running systems which are unicode-enabled by default.

On a side note, the response sent by httpd to the browser is a 403 Forbidden 
in this case, which is I think not an appropriate translation of the mod_dav 
error above, perhaps 500 would be more suitable. I can file a separate bug 
report if there is consensus on that issue.

-- Package-specific info:
List of enabled modules from 'apache2 -M':
  actions alias auth_basic authn_file authz_default authz_groupfile
  authz_host authz_svn authz_user autoindex cgi dav dav_svn deflate
  dir env mime negotiation php5 proxy_http proxy setenvif status
  userdir

-- System Information:
Debian Release: 5.0
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.18-5-686 (SMP w/1 CPU core)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages apache2-mpm-prefork depends on:
ii  apache2.2-common 2.2.9-10+lenny1 Apache HTTP Server common files
ii  libapr1  1.2.12-5The Apache Portable Runtime 
Librar
ii  libaprutil1  1.2.12+dfsg-8   The Apache Portable Runtime 
Utilit
ii  libc62.7-16  GNU C Library: Shared libraries
ii  libpcre3 7.6-2.1 Perl 5 Compatible Regular 
Expressi

apache2-mpm-prefork recommends no packages.

apache2-mpm-prefork suggests no packages.

-- no debconf information




-- 
To UNSUBSCRIBE, email to debian-apache-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#285363: apache: AddDefaultCharset might not work

2004-12-12 Thread Josef Spillner
Package: apache
Version: 1.3.33-2
Severity: normal

When using the latest version of 'apache' and 'php4' on sid,
something weird happens with the charset attribute in the headers
sent out by Apache.
I believe this is a double problem (in both Apache and PHP) but feel
free to reassign if you think this belongs to only one of the packages.

The PHP side:
No matter what combination of default_mimetype and default_charset is
given in php.ini, or empty values even, PHP will always output an empty
charset for me.
 Content-type: text/html; charset=

The Apache side:
If such a statement is present, apache skips adding a charset (even if
requested) because it thinks it already has a charset appended to the
header.
The source has a FIXME about verification in this case, this is what I'm
trying to do here.

Note that the charset directive works fine for e.g. *.html files, so
it's certainly some PHP involvement. But I still think Apache should
override in this case.

A patch which fixes the issue is attached.
It's rather a patch proposal though - all I want is to get my pages in
utf-8 without writing a content-modifying proxy :)

Depending on the reply, I will open another report with the PHP package.

Josef

-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: powerpc (ppc)
Kernel: Linux 2.6.9-powerpc
Locale: LANG=pt_BR, LC_CTYPE=pt_BR (charmap=ISO-8859-1)

Versions of packages apache depends on:
ii  apache-common   1.3.33-2 Support files for all Apache 
webse
ii  debconf 1.4.39   Debian configuration management 
sy
ii  dpkg1.10.24  Package maintenance system for 
Deb
ii  libc6   2.3.2.ds1-18 GNU C Library: Shared libraries 
an
ii  libdb4.24.2.52-17Berkeley v4.2 Database Libraries 
[
ii  libexpat1   1.95.8-1 XML parsing C library - runtime 
li
ii  libmagic1   4.10-3   File type determination library 
us
ii  logrotate   3.7-2Log rotation utility
ii  mime-support3.28-1   MIME files 'mime.types'  
'mailcap
ii  perl5.8.4-3  Larry Wall's Practical Extraction 

-- debconf information excluded
--- http_protocol.c.old	2004-12-12 20:38:25.300493184 +0100
+++ http_protocol.c	2004-12-12 20:48:09.746643864 +0100
@@ -82,6 +82,7 @@
 	NULL };
 char **pcset;
 core_dir_config *conf;
+int addcharset = 1, addcharsetname = 1;
 
 conf = (core_dir_config *)ap_get_module_config(r-per_dir_config,
core_module);
@@ -93,17 +94,22 @@
 }
 
 if (ap_strcasestr(type, charset=) != NULL) {
-	/* already has parameter, do nothing */
-	/* XXX we don't check the validity */
-	;
+if (*(ap_strcasestr(type, charset=) + strlen(charset=))) {
+/* already has parameter, do nothing */
+/* XXX we don't check the validity */
+addcharsetname = 0;
+	} else {
+/* empty charset= statement */
+addcharset = 0;
+}
 }
-else {
+if (addcharsetname) {
 	/* see if it makes sense to add the charset. At present,
 	 * we only add it if the Content-type is one of needcset[]
 	 */
 	for (pcset = needcset; *pcset ; pcset++) {
 	if (ap_strcasestr(type, *pcset) != NULL) {
-		type = ap_pstrcat(r-pool, type, ; charset=, 
+		type = ap_pstrcat(r-pool, type, (addcharset ? ; charset= : ), 
   conf-add_default_charset_name, NULL);
 		break;
 	}