Commit 11b2a67e authored by Amos Latteier's avatar Amos Latteier

Fixed a HTTP request bug which prevented ZPublisher.Client from being able to...

Fixed a HTTP request bug which prevented ZPublisher.Client from being able to upload files to ZServer.
parent 937ad900
...@@ -103,7 +103,7 @@ that allows one to simply make a single web request. ...@@ -103,7 +103,7 @@ that allows one to simply make a single web request.
The module also provides a command-line interface for calling objects. The module also provides a command-line interface for calling objects.
""" """
__version__='$Revision: 1.32 $'[11:-2] __version__='$Revision: 1.33 $'[11:-2]
import sys, regex, socket, mimetools import sys, regex, socket, mimetools
from httplib import HTTP from httplib import HTTP
...@@ -270,7 +270,7 @@ class Function: ...@@ -270,7 +270,7 @@ class Function:
c=replace(encodestring('%s:%s' % (self.username,self.password)),'\012','') c=replace(encodestring('%s:%s' % (self.username,self.password)),'\012','')
rq.append('Authorization: Basic %s' % c) rq.append('Authorization: Basic %s' % c)
rq.append(MultiPart(d).render()) rq.append(MultiPart(d).render())
rq=join(rq,'\n') rq=join(rq,'\r\n')
try: try:
sock=socket.socket(socket.AF_INET,socket.SOCK_STREAM) sock=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
...@@ -524,7 +524,7 @@ class MultiPart: ...@@ -524,7 +524,7 @@ class MultiPart:
s.append('%s: %s' % (n,v['_v'])) s.append('%s: %s' % (n,v['_v']))
for k in v.keys(): for k in v.keys():
if k != '_v': s.append('; %s=%s' % (k, v[k])) if k != '_v': s.append('; %s=%s' % (k, v[k]))
s.append('\n') s.append('\r\n')
p=[] p=[]
t=[] t=[]
b=self._boundary b=self._boundary
...@@ -533,7 +533,7 @@ class MultiPart: ...@@ -533,7 +533,7 @@ class MultiPart:
t.append(join(p,'\n--%s\n' % b)) t.append(join(p,'\n--%s\n' % b))
t.append('\n--%s--\n' % b) t.append('\n--%s--\n' % b)
t=join(t,'') t=join(t,'')
s.append('Content-Length: %s\n\n' % len(t)) s.append('Content-Length: %s\r\n\r\n' % len(t))
s.append(t) s.append(t)
return join(s,'') return join(s,'')
...@@ -543,8 +543,8 @@ class MultiPart: ...@@ -543,8 +543,8 @@ class MultiPart:
s.append('%s: %s' % (n,v['_v'])) s.append('%s: %s' % (n,v['_v']))
for k in v.keys(): for k in v.keys():
if k != '_v': s.append('; %s=%s' % (k, v[k])) if k != '_v': s.append('; %s=%s' % (k, v[k]))
s.append('\n') s.append('\r\n')
s.append('\n') s.append('\r\n')
if self._boundary: if self._boundary:
p=[] p=[]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment