-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sep 5, 2008, at 4:29 AM, Gisle Aas wrote:
Hi Michael,

This seems like a very useful addition to libwww-perl.  I have been
wanting a mode where $response->as_string would show responses exactly
as they where received without adding,  or reordering of the headers
or even fix up the casing for the header field names.  A patch like
yours should make this much easier.

Your patch does not address the preserving-of-case for header filed
names.  Is that not required for your signing server?

We join the values of the signed headers without the name of the header so case doesn't matter for us. That said, it certainly makes sense to store the headers in their original case in _wire_order rather than the normalized version. Should the header_field_names and the pass method both then return the headers in the original case when dont_sort is passed?

It also seems your approach makes it hard to deal correctly with
repeated headers mixed in with others; for instance something like
this ugly response:

   200 OK
   Server: Fool/1.0
   content-encoding  :
       gzip
   Content-Type: text/plain; charset="UTF-8"
   Content-Encoding: base64
   Date: Fri Sep  5 10:24:37 CEST 2008

   H4sICETrwEgAA3h4eADLSM3JyVcozy/KSVHkAgC0r9cBDQAAAA==

Your thoughts?


I'm not sure exactly what the right way to handle this would be. header_field_names is speced in the docs as returning only the distinct header field names. Perhaps rather than an optional dont_sort argument this should be a new method, something like 'wire_header_fields' that returns all headers in the original case and order including duplicates? This also relates to the as_string method and your desire to have a mode that returns things in thier original form.

Writing code is easy, it's deciding how that code should behave that is the hard part.

Mike

- --
Michael Greb
Linode.com
609-593-7103 ext 1205



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)

iD8DBQFIwXFH0Qbp4bPZvesRAn5GAJ9KmpEkjkbfWSPgkSp3ikR1htcNTwCfad0p
ClhR1t38odclA0rpBtnXFTc=
=nkoH
-----END PGP SIGNATURE-----

Reply via email to