Re: [Zope] cannot access POST content in Zope

2007-08-17 Thread Manuel Spuhler

Hello Martijn,

many thanks for your answer



Zope special-cases POST requests with content-type text/xml; it treats
these as XML-RPC requests. I don't think you can work around this
either. :(


Ok, I see, this is bad for me :-/



Take a look at HTTPRequest.processInputs in lib/python/HTTPRequest.py,
together with lib/python/xmlrpc.py in your Zope installation, to see
if you find a way around this, or where to patch to disable this.

The easier way would for you to alter the format in which the SMS
gateway contacts the Zope server, though. A properly encoded POST
request (multipart/form-data) would be much preferable and easier to
deal with than patching Zope ;).


I'll try the easiest way first,
but as it's not standard, I might have to patch Zope

in HTTPRequest.py I found

# Hm, maybe it's an XML-RPC
if (fs.headers.has_key('content-type') and
'text/xml' in fs.headers['content-type'] and
method == 'POST'):
# Ye haaa, XML-RPC!

This could make my day ;-)

Regards

Manuel Spuhler



--
Martijn Pieters


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] cannot access POST content in Zope

2007-08-17 Thread Manuel Spuhler

sorry I mean



 empty when content-type is 'text/xml'


___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] cannot access POST content in Zope

2007-08-17 Thread Manuel Spuhler

Hi Andreas,

thank for your answer



No idea where and how you look for the uploaded content.
Everything in Zope is available from the REQUEST. And of course you  
can _not_ upload something to the mutator method of some object.  
This makes zero sense.
You might write your script that takes the data from the REQUEST  
and calls the API method e.g. a mutator method.


I think you misunderstood, curl send it in a form,  content is not  
*uploaded* but encoded in a POST 'text/xml'
and it's sent to a  script  from which which I look at  
request.RESPONSE.form, but it's empty when content-type is  
'application/x-www-form-urlencoded'

my problem is probably about content-type



P.S. Plone specific questions belong to the plone-users list


i think it is a Zope question, below the fact I'm using Plone

Regards

M.

___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
http://mail.zope.org/mailman/listinfo/zope-announce

http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] cannot access POST content in Zope

2007-08-17 Thread Martijn Pieters
On 8/17/07, Manuel Spuhler <[EMAIL PROTECTED]> wrote:
> but the content of the POST is empty when I do
>
> curl http://elevator.sytes.net/RSR/setSMS -H "Content-Type: text/xml"
> -d @post.xml
>
> I'm working on integrating SMS on Plone, and the external system sends
> me a text/xml header, text/xml is the right type, I think, according
> rfc 3023
>
> I have been tracking the frames through tcpdump and the request looks
> good before zope.

Zope special-cases POST requests with content-type text/xml; it treats
these as XML-RPC requests. I don't think you can work around this
either. :(

Take a look at HTTPRequest.processInputs in lib/python/HTTPRequest.py,
together with lib/python/xmlrpc.py in your Zope installation, to see
if you find a way around this, or where to patch to disable this.

The easier way would for you to alter the format in which the SMS
gateway contacts the Zope server, though. A properly encoded POST
request (multipart/form-data) would be much preferable and easier to
deal with than patching Zope ;).

-- 
Martijn Pieters
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] cannot access POST content in Zope

2007-08-16 Thread Andreas Jung



--On 17. August 2007 01:52:27 +0200 Manuel Spuhler 
<[EMAIL PROTECTED]> wrote:



Hello,

I am trying to record the result of a POST request sent to Plone.

I can get the content of the POST when I send the file post.xml (valid
xml)



No idea where and how you look for the uploaded content. Everything in Zope 
is available from the REQUEST. And of course you can _not_ upload something 
to the mutator method of some object. This makes zero sense. You might 
write your script that takes the data from the REQUEST and calls the API 
method e.g. a mutator method.


-aj

P.S. Plone specific questions belong to the plone-users list

pgpA7vqHUVu2q.pgp
Description: PGP signature
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] cannot access POST content in Zope

2007-08-16 Thread Manuel Spuhler
Hello,

I am trying to record the result of a POST request sent to Plone.

I can get the content of the POST when I send the file post.xml (valid xml)

curl http://elevator.sytes.net/RSR/setSMS -d @post.xml

In this case, CONTENT_TYPE headers is set to
'application/x-www-form-urlencoded' by curl.

but the content of the POST is empty when I do

curl http://elevator.sytes.net/RSR/setSMS -H "Content-Type: text/xml"
-d @post.xml

I'm working on integrating SMS on Plone, and the external system sends
me a text/xml header, text/xml is the right type, I think, according
rfc 3023

I have been tracking the frames through tcpdump and the request looks
good before zope.

I have then parsed the code of Zope to find where I could change this,
but I can't figure it out for the moment, and maybe it's something
which need to be changed.

Could you help me to fix this please?

Best regards

Manuel Spuhler
www.rsr.ch


Zope 2.9.7-final, python 2.4.4, Plone 2.5.3
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )