Groups
Groups
Sign in
Groups
Groups
python-cn-free(中文python邮件列表)
Conversations
About
Send feedback
Help
httplib 直接发送二进制数据
62 views
Skip to first unread message
silent paul
unread,
Aug 13, 2012, 12:11:38 AM
8/13/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to python-...@googlegroups.com
貌似httplib 不能直接发送二进制数据,我看了下代码:
发送前要看数据是不是 str 实例,但是用open({filename}).read()这种形式读取的数据都是str,
所以httplib总是会把 二进制数据和header的信息相加再发送,这样对二进制数据decode的时候就报错。
http post 支持直接在body中发送二进制数据吗?
httplib 应该怎么发送二进制数据,
就是直接在请求body里面写二进制数据,不采用multipart/form-data 的形式?
Yesheng Zou
unread,
Aug 13, 2012, 12:40:05 AM
8/13/12
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to silent paul, python-cn-free(中文python邮件列表)
在 2012年8月13日 下午12:11,silent paul
<
silentp...@gmail.com
>
写道:
就是直接在请求body里面写二进制数据,不采用multipart/form-data 的形式?
可以写二进制,只要你的 Server 端支持就可以。
比如 Exchange 协议,它是用的 HTTP 。但是它 POST 到服务端的数据的 Content-Type 规定是 application/vnd.ms-sync.wbxml。
然后,它的 Body 部分是 WBXML 数据,就是二进制的。
--
进出自由才是游戏者的生存之道。
http://zouyesheng.com
Reply all
Reply to author
Forward
0 new messages