Hi Folks,
I'm doing a multipart/related POST to my web.py server, and want to be
able to get at the headers in the mime parts. I haven't found a
comfortable way of handling multipart messages in web.py, perhaps
someone could give me some hints as to where to look? I have an HTTP
request like this:
POST /server HTTP/1.1
Authorization: Basic ZGFmZnk6c2VjZXJldA==
Content-Length: nnn
Content-Type: multipart/related;
boundary="===============0364140910==";
type="application/atom+xml"
MIME-Version: 1.0
--===============0364140910==
Content-Type: application/atom+xml
MIME-Version: 1.0
Content-Disposition: attachment; name="atom"
<?xml version="1.0"?>
<entry xmlns="http://www.w3.org/2005/Atom"
xmlns:dcterms="http://purl.org/dc/terms/">
</entry>
--===============0364140910==
Content-Type: application/zip
MIME-Version: 1.0
Content-Disposition: attachment; name="payload"; filename="example.zip"
Content-Transfer-Encoding: base64
UEsDBBQAAAAIAESPTTc8cx/9sQYAAAEYAAAIABUAbWV0cy54bWxVVAkAAyD5EEch+RBHVXgEAPUB
....
--===============0364140910==--
At the server end, I can access the content of the parts with:
webin = web.input()
atom = webin["atom"]
zip = webin["zip"]
But I've not been able to find out how to access any of the other
headers at the top of each mime part.
It seems like the Content-Disposition "name" parameter is used to name
the dictionary indices in web.input() for each mime part's content. I'd
like to get rid of the Content-Disposition header altogether and also be
able to access the other headers. I considered reading the message in
with the email.mime package, but when I try to get the raw POST request
body with web.data() the server just times out on it.
Any hints much appreciated.
Cheers,
Richard
--
You received this message because you are subscribed to the Google Groups
"web.py" 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/webpy?hl=en.