You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Dave Moore <da...@epals.com> on 2000/08/08 23:55:19 UTC

custom server string

i need to change the outgoing Server header on all requests to our site.
dont ask why I would want to do that. i have my orders. i read some old
posts from the 90's which said I would have to write my own
send_http_header() method. sounds fun but id rather not. Is this still the
case and if so...why? has anyone else had to do this?

dave

--
Dave Moore
Web Application Developer
mailto:dave@epals.com

ePALS Classroom Exchange
http://www.epals.com/
Connecting more than 1.9 million students and teachers in 182 countries!



Re: custom server string

Posted by Vivek Khera <kh...@kciLink.com>.
>>>>> "DM" == Dave Moore <da...@epals.com> writes:

DM> i need to change the outgoing Server header on all requests to our site.
DM> dont ask why I would want to do that. i have my orders. i read some old
DM> posts from the 90's which said I would have to write my own
DM> send_http_header() method. sounds fun but id rather not. Is this still the
DM> case and if so...why? has anyone else had to do this?

Just yesterday Randal posted a handler here that adds a
X_mod_perl_rules header to every page out of his site.  Perhaps you
could modify that?

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vivek Khera, Ph.D.                Khera Communications, Inc.
Internet: khera@kciLink.com       Rockville, MD       +1-301-545-6996
GPG & MIME spoken here            http://www.khera.org/~vivek/

Re: custom server string

Posted by Dave Moore <da...@epals.com>.
On Thu, 10 Aug 2000, Thomas von Elling Skifter Eibner wrote:

> On Tue, Aug 08, 2000 at 05:55:19PM -0400, Dave Moore wrote:
> > 
> > i need to change the outgoing Server header on all requests to our site.
> > dont ask why I would want to do that. i have my orders. i read some old
> > posts from the 90's which said I would have to write my own
> > send_http_header() method. sounds fun but id rather not. Is this still the
> > case and if so...why? has anyone else had to do this?
> 
> Is it the whole of the Server string you want to change or do you just
> want to add your own module name? If it is the later you can make a
> simple little module in C that uses the ap_add_version_component()
> function. If you want to change the whole Server string you'd probably
> have to edit the source files of apache.

yeah....the whole enchilada. thats what we ended up doing. puting it right
in the source and recompiling....[sigh]. oh well, even still, mod_perl
rules.

> 
> --
> Thomas Eibner
> 

--
Dave Moore
Web Application Developer
mailto:dave@epals.com

ePALS Classroom Exchange
http://www.epals.com/
Connecting more than 1.9 million students and teachers in 182 countries!


Re: custom server string

Posted by Thomas von Elling Skifter Eibner <th...@io.stderr.net>.
On Tue, Aug 08, 2000 at 05:55:19PM -0400, Dave Moore wrote:
> 
> i need to change the outgoing Server header on all requests to our site.
> dont ask why I would want to do that. i have my orders. i read some old
> posts from the 90's which said I would have to write my own
> send_http_header() method. sounds fun but id rather not. Is this still the
> case and if so...why? has anyone else had to do this?

Is it the whole of the Server string you want to change or do you just want to add your own module name? If it is the later you can make a simple little module in C that uses the ap_add_version_component() function. If you want to change the whole Server string you'd probably have to edit the source files of apache.

--
Thomas Eibner

RE: weird print bug?

Posted by Ken Williams <ke...@forum.swarthmore.edu>.
dharris@drh.net (David Harris) wrote:
>T.J. Mather [mailto:tjmather@thoughtstore.com] wrote:
>> However it doesn't work if you apply a non-greedy substitution operator on
>> the scalar.
>
>You mean "global", not "greedy"

True, but not especially helpful in this case.

T.J., if you grok XS you might have a look at this part of
write_client() in Apache.xs:

    for(i = 1; i <= items - 1; i++) {
        int sent = 0;
        SV *sv = SvROK(ST(i)) && (SvTYPE(SvRV(ST(i))) == SVt_PV) ?
                 (SV*)SvRV(ST(i)) : ST(i);
        buffer = SvPV(sv, len);


Try looking at your $text with Devel::Peek to see whether there are any
differences in what it contains in the two cases.




RE: weird print bug?

Posted by David Harris <dh...@drh.net>.
T.J. Mather [mailto:tjmather@thoughtstore.com] wrote:
> However it doesn't work if you apply a non-greedy substitution operator on
> the scalar.

You mean "global", not "greedy"

Two snippets from the perl documentation:

s/PATTERN/REPLACEMENT/egimosx

Options are:
    e   Evaluate the right side as an expression.
    g   Replace globally, i.e., all occurrences.
    i   Do case-insensitive pattern matching.
    ....

-- and --

By default, a quantified subpattern is ``greedy'', that is, it will match as
many times as possible (given a particular starting location) while still
allowing the rest of the pattern to match. If you want it to match the minimum
number of times possible, follow the quantifier with a ``?''. Note that the
meanings don't change, just the ``greediness'':

    *?     Match 0 or more times
    +?     Match 1 or more times
    ....

David




weird print bug?

Posted by "T.J. Mather" <tj...@thoughtstore.com>.
Hi,

I'm running into some very strange behaviour with Apache::print.  print() 
is supposed to dereference any arguments that are scalar references.

However it doesn't work if you apply a non-greedy substitution operator on
the scalar.

The following code outputs in my browser:

CODE:
sub handler {
  my $r = shift;
  my $text = "hello world";
  $text =~ s/hello/hi/;
  $r->print(\$text);
}

OUTPUT:
SCALAR(0x89bd084)

What's really weird is that it works if i change the
substitution operator to greedy:

CODE:
sub handler {
  my $r = shift;
  my $text = "hello world";
  $text =~ s/hello/hi/g;    # <--- changed to /g
  $r->print(\$text);
}

OUTPUT:
hi world

Any ideas?  I'm running Perl 5.6.0/mod_perl 1.24/Apache 1.3.12 on Linux
2.2.12 (red hat 6.1) on i686.

Thanks,
T.J. Mather