Made a test script:
=============================
#!/usr/bin/perl
use Apache2::RequestUtil;
my $request = Apache2::RequestUtil->request;
$request->headers_out->add('Testheader' => 'Testvalue');
$request->err_headers_out->add('TestheaderErr' => 'TestvalueErr');
$request->status(304);
return 304;
===============================
Returned this:
===============================
HTTP/1.1 304 Not Modified
Date: Wed, 12 Nov 2014 17:45:55 GMT
Server: Apache
Connection: Keep-Alive
Keep-Alive: timeout=30
===============================
And if you set status to 200 - get both headers.
2014-11-12 19:45 GMT+03:00 Adam Prime <[email protected]>:
> Can we see the code you're running into this issue with? It sounds like
> confusion between $r->headers_out and $r->err_headers_out to me.
>
> Adam
>
>
> On 14-11-12 05:09 AM, Alexandr Evstigneev wrote:
>
>> 1. Problem Description:
>>
>> It seems, that if I set status to 304, all custom headers being ignored
>> and not sent to to the client.
>> I'm making cross-domain ajax script and it should pass
>> Access-Control-Allow-Origin even on 304 response.
>> Works fine if data been modified but 304 response has no my headers.
>>
>> 2. Used Components and their Configuration:
>>
>> *** mod_perl version 2.000008
>>
>> *** using /usr/local/lib/perl5/site_perl/5.20/mach/Apache2/BuildConfig.pm
>>
>> *** Makefile.PL options:
>> MP_APR_CONFIG => /usr/local/bin/apr-1-config
>> MP_APR_LIB => aprext
>> MP_APXS => /usr/local/sbin/apxs
>> MP_COMPAT_1X => 1
>> MP_GENERATE_XS => 1
>> MP_LIBNAME => mod_perl
>> MP_USE_DSO => 1
>>
>>
>> *** The httpd binary was not found
>>
>>
>> *** (apr|apu)-config linking info
>>
>> -L/usr/local/lib -laprutil-1 -ldb-5.3 -lgdbm -lexpat -liconv
>> -L/usr/lib -L/usr/local/lib -L/usr/local/lib/db5
>> -L/usr/local/lib -lapr-1 -lcrypt -lpthread
>>
>>
>>
>> *** /usr/local/bin/perl -V
>> Summary of my perl5 (revision 5 version 20 subversion 1) configuration:
>>
>> Platform:
>> osname=freebsd, osvers=9.3-release-p4,
>> archname=amd64-freebsd-thread-multi
>> uname='freebsd storage.cobweb-software.com
>> <http://storage.cobweb-software.com/> 9.3-release-p4 freebsd
>>
>> 9.3-release-p4 #0 r273928: sat nov 1 17:16:18 msk 2014
>> [email protected]:usrobjusrsrcsysgeneric amd64 '
>> config_args='-sde -Dprefix=/usr/local
>> -Darchlib=/usr/local/lib/perl5/5.20/mach
>> -Dprivlib=/usr/local/lib/perl5/5.20
>> -Dman3dir=/usr/local/lib/perl5/5.20/perl/man/man3
>> -Dman1dir=/usr/local/man/man1
>> -Dsitearch=/usr/local/lib/perl5/site_perl/5.20/mach
>> -Dsitelib=/usr/local/lib/perl5/site_perl/5.20 -Dscriptdir=/usr/local/bin
>> -Dsiteman3dir=/usr/local/lib/perl5/5.20/man/man3
>> -Dsiteman1dir=/usr/local/man/man1 -Ui_malloc -Ui_iconv
>> -Uinstallusrbinperl -Dcc=cc -Duseshrplib -Dinc_version_list=none
>> -Dccflags=-DAPPLLIB_EXP="/usr/local/lib/perl5/5.20/BSDPAN" -Doptimize=-g
>> -DDEBUGGING -Ui_gdbm -Dusemultiplicity=y -Duse64bitint -Dusethreads=y
>> -Dusemymalloc=n'
>> hint=recommended, useposix=true, d_sigaction=define
>> useithreads=define, usemultiplicity=define
>> use64bitint=define, use64bitall=define, uselongdouble=undef
>> usemymalloc=n, bincompat5005=undef
>> Compiler:
>> cc='cc', ccflags ='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.20/BSDPAN"
>> -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -DDEBUGGING -fno-strict-aliasing
>> -pipe -fstack-protector -I/usr/local/include',
>> optimize='-g',
>> cppflags='-DAPPLLIB_EXP="/usr/local/lib/perl5/5.20/BSDPAN"
>> -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -DDEBUGGING -fno-strict-aliasing
>> -pipe -fstack-protector -I/usr/local/include'
>> ccversion='', gccversion='4.2.1 20070831 patched [FreeBSD]',
>> gccosandvers=''
>> intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
>> d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
>> ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t',
>> lseeksize=8
>> alignbytes=8, prototype=define
>> Linker and Libraries:
>> ld='cc', ldflags ='-pthread -Wl,-E -fstack-protector
>> -L/usr/local/lib'
>> libpth=/usr/lib /usr/local/lib /usr/include/gcc/4.2 /usr/lib
>> libs=-lgdbm -lm -lcrypt -lutil
>> perllibs=-lm -lcrypt -lutil
>> libc=, so=so, useshrplib=true, libperl=libperl.so
>> gnulibc_version=''
>> Dynamic Linking:
>> dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='
>> -Wl,-R/usr/local/lib/perl5/5.20/mach/CORE'
>> cccdlflags='-DPIC -fPIC', lddlflags='-shared -L/usr/local/lib
>> -fstack-protector'
>>
>>
>> Characteristics of this binary (from libperl):
>> Compile-time options: DEBUGGING HAS_TIMES MULTIPLICITY PERLIO_LAYERS
>> PERL_DONT_CREATE_GVSV
>> PERL_HASH_FUNC_ONE_AT_A_TIME_HARD
>> PERL_IMPLICIT_CONTEXT PERL_MALLOC_WRAP
>> PERL_NEW_COPY_ON_WRITE PERL_PRESERVE_IVUV
>> PERL_TRACK_MEMPOOL USE_64_BIT_ALL USE_64_BIT_INT
>> USE_ITHREADS USE_LARGE_FILES USE_LOCALE
>> USE_LOCALE_COLLATE USE_LOCALE_CTYPE
>> USE_LOCALE_NUMERIC USE_PERLIO USE_PERL_ATOF
>> USE_REENTRANT_API
>> Built under freebsd
>> Compiled at Nov 9 2014 08:27:44
>> %ENV:
>> PERL5LIB="/raid/www/lib"
>> PERL_LWP_USE_HTTP_10="1"
>> @INC:
>> /raid/www/lib
>> /usr/local/lib/perl5/5.20/BSDPAN
>> /usr/local/lib/perl5/site_perl/5.20/mach
>> /usr/local/lib/perl5/site_perl/5.20
>> /usr/local/lib/perl5/5.20/mach
>> /usr/local/lib/perl5/5.20
>> .
>>
>> *** Packages of interest status:
>>
>> Apache2 : -
>> Apache2::Request : -
>> CGI : 3.65
>> ExtUtils::MakeMaker: 6.98, 6.98
>> LWP : 6.08
>> mod_perl : -
>> mod_perl2 : 2.000008
>>
>>
>> 3. This is the core dump trace: (if you get a core dump):
>>
>> [CORE TRACE COMES HERE]
>>
>> This report was generated by /usr/local/bin/mp2bug on Wed Nov 12
>> 09:51:30 2014 GMT.
>>
>
>