Stas Bekman wrote:

Philippe M. Chiasson wrote:

I've just finished adding back $r->content_languages to mp2.

Worth noting is the 2 util functions to convert to and from AV <-> apr_array_header_t

I believe there are a few other struct members that are of type apr_array_header_t and
are currently not handled. I'll get those later.


gozer++

+1, sans a few minor formatting issues below :)

and I suppose the doc is on the way, right? if not add an entry to api_status and turn the V flag down. :)

Correct. The doc is also on the way ;-)

Index: src/modules/perl/modperl_util.c


+apr_array_header_t *modperl_avrv2apr_array_header(pTHX_ apr_pool_t *p, SV *avrv)


line too long

+{
+    AV *av;
+    apr_array_header_t *array;
+    int i, av_size;
+    +    if (!(SvROK(avrv) && (SvTYPE(SvRV(avrv)) == SVt_PVAV))) {
+        Perl_croak(aTHX_ "Not an array reference");
+    }
+    +    av = (AV*)SvRV(avrv);
+    av_size = av_len(av);
+    array = apr_array_make(p, av_size+1, sizeof(char *));
+    +    for(i = 0; i <= av_size; i++) {

^^^^^^ space


> Index: t/response/TestAPI/request_rec.pm > ===================================================================

> + # content_languages
> + {
> + my $l = [qw(fr-ca en-ca en-us)];
> + ok t_cmp $r->content_languages, [], '$r->content_languages';
> + ok t_cmp $r->content_languages($l), [], '$r->content_languages';
> + ok t_cmp $r->content_languages, $l, '$r->content_languages';
> +
> + eval { $r->content_languages({}) };
> + ok t_cmp $@, qr/Not an array reference/,
> + '$r->content_languages(invalid)';
> + }

But won't it better to make the test more real, by getting the client side send a real C-L header? or is this one sent only by the server, I don't remember?

Yes, this one is sent by the server to indicate what language a certain entity is in. You can control these with AddLanguage DefaultLanguage, etc. I've adjusted the tests accdordingly.


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to