On 12 March 2010 16:31, Graham Dumpleton <[email protected]> wrote:
> On 12 March 2010 16:22, Graham Dumpleton <[email protected]> wrote:
>> On 12 March 2010 11:39, Graham Dumpleton <[email protected]> wrote:
>>> On 11 March 2010 23:43, Ken Elkabany <[email protected]> wrote:
>>>> Hello,
>>>>
>>>> My client program is sending a gzip-ed http request, which is
>>>> decompressed by the mod-deflate InputFilter in Apache. This works when
>>>> I am using modwsgi (without any custom configurations) to serve a
>>>> django site that is receiving compressed requests. However, when I
>>>> turn on daemon mode via the WSGIDaemonProcess directive, the django
>>>> site begins receiving garbled requests which I interpret as the mod-
>>>> deflate not being active. The error is 100% reproducible, and simply
>>>> commenting out the WSGIDaemonProcess line makes everything work again
>>>> (I'm leaving in the WSGIScriptAlias directive). Any ideas?
>>>>
>>>> Side Note: If you're wondering how I compress http requests for wsgi:
>>>> My wsgi script scans through the wsgi.input (environ dictionary),
>>>> calculates the decompressed content length, and then changes CONTENT-
>>>> LENGTH appropriately before the request enters django.
>>>
>>>
>>> Can you post the WSGI wrapper you are using to recalculate
>>> CONTENT_LENGTH and supply alternate wsgi.input to inner application?
>>>
>>> Have you use something like second recipe in:
>>>
>>> http://code.google.com/p/modwsgi/wiki/DebuggingTechniques#Tracking_Request_and_Response
>>>
>>> to record the actual request headers and request body which are going
>>> in to that wrapper and verified that the content is actually the same
>>> as the original compressed content?
>>>
>>> Can you supply a standalone Python script which acts as a HTTP client
>>> to send the compressed content as otherwise don't have a ready way of
>>> doing testing as don't have anything myself which does that?
>
> In absence of standalone program, can you validate that using something like:
>
> curl -H 'Content-Encoding: gzip' -d @foo.sh.gz
> http://tests.example.com/echo.wsgi
>
> gives same affect as what you are intending and can be used for testing.

Which now suspect will not, at least to extent that can't just use
'gzip' to compress a file and send it. This is because it is like:

$ od -c foo.sh.gz
0000000  037 213  \b  \b 370 376   p   K  \0 003   f   o   o   .   s   h
0000020   \0   S   V 324   O 312 314 323   / 316 340 342   J   M 316 127
0000040    W 360 310 344 002  \0 271   i 004   0 023  \0  \0  \0
0000056

The code checks for:

        /* We didn't get the magic bytes. */
        if (len != 10 ||
            deflate_hdr[0] != deflate_magic[0] ||
            deflate_hdr[1] != deflate_magic[1]) {
            return APR_EGENERAL;
        }

        /* We can't handle flags for now. */
        if (deflate_hdr[3] != 0) {
            return APR_EGENERAL;
        }

and thus failing on the latter test of byte 4 being '0'.

So, still need a client, or way of compressing data in the correct way
to feed into curl.

Graham

> Graham
>
>>> Finally, exactly what version of mod_wsgi are you using, what Apache
>>> version and what platform?
>>
>> Can you also post the configuration used in Apache to enable DEFLATE
>> input filter?
>>
>> Graham
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.

Reply via email to