Re: Apache::ASP problem with post data
I think this will be intresting in the future when HTTP servers will be used for other things than just web pages serving. First thing i can think of is XML-RPC and SOAP technologie . Maybe this is something for a future release of the ASP framework ? greetings, luc Joshua Chamas wrote: I have an ASP version which incorporates this patch for reading non-form POST data. Let me know if you all want it. --Josh Luc Willems wrote: the result of $Response- is also empty. i had a look into the Apache::ASP source code and found this : (line 843) $self-{content} = $r-content(); tie(*STDIN, 'Apache::ASP::Request', $self) if defined($self-{content}); this means that it's comming from $r-content() which i think is a apache object. (what the tie does , i don't know ) so looking further in the apache module i found that sub content { my($r) = @_; my $ct = $r-header_in("Content-type") || ""; return unless $ct eq "application/x-www-form-urlencoded"; my $buff; $r-read($buff, $r-header_in("Content-length")); parse_args(wantarray, $buff); } it seems that the "Content-type" must be "application/x-www-form-urlencoded" before we can get anything out of the content() routine from mod_perl :-( So i tried this #Get posted XML query $len = $Request-{TotalBytes}; $Request-{asp}-{r}-read($i,$len); this will work always without taking into acount the content-type , which is text/xml I don't know if there is any problem with doing it this way ? If anybody has a clue on this , let me know . greetings, luc Brendan McKenna wrote: Hi, The 156 bytes are your data. Since you're using Perl, you should be able to access your data using $Response-content; Brendan : : hello , : : : i'm working on a project that involves some XML-RPC system. The idea is : to POST a XML to a ASP script which will than process this : and return a XML back to the client. : : To do that a send sommething like this (output from ethereal dump) : : : POST /cp-bin/rc2.asp HTTP/1.0 : Host: linux : User-Agent: libwww-perl/5.36 : Content-Length: 156 : Content-Type: text/xml : : ?xml version="1.0"? : methodCall : methodNameexamples.getStateName/methodName : params : paramvaluei41/i4/value/param : /params : /methodCall : : The problem now is , that in the asp script i get a Totalbytes of 156 : bytes but the content string is empty ? : : #Get posted XML query : my $len = $Request-{TotalBytes}; : my $i = $Request-BinaryRead($len); : : #log input query : $Response-Debug("recieved $len bytes"); : $Response-Debug("data [$i]"); : : Does anybody has a clue where the 156 bytes are ??? : : thanks : luc willems : : - : To unsubscribe, e-mail: [EMAIL PROTECTED] : For additional commands, e-mail: [EMAIL PROTECTED] : -- Brendan McKenna Technical Director Phone: +353-(0)61-338177 x4143 W3 Services Ltd. Fax: +353-(0)61-338065 Innovation Centre Email: [EMAIL PROTECTED] National Technological Park Limerick Ireland
Re: Apache::ASP problem with post data
Luc Willems wrote: it seems that the "Content-type" must be "application/x-www-form-urlencoded" before we can get anything out of the content() routine from mod_perl :-( #Get posted XML query $len = $Request-{TotalBytes}; $Request-{asp}-{r}-read($i,$len); I'll change the Apache::ASP code to read() instead of content() just for this reason. I might only parse it for Form() if "application/x-www-form-urlencoded" but at least it'll be there for BinaryRead() Thanks for figuring this out. --Josh _ Joshua Chamas Chamas Enterprises Inc. NodeWorks free web link monitoring Huntington Beach, CA USA http://www.nodeworks.com1-714-625-4051 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Apache::ASP problem with post data
the result of $Response- is also empty. i had a look into the Apache::ASP source code and found this : (line 843) $self-{content} = $r-content(); tie(*STDIN, 'Apache::ASP::Request', $self) if defined($self-{content}); this means that it's comming from $r-content() which i think is a apache object. (what the tie does , i don't know ) so looking further in the apache module i found that sub content { my($r) = @_; my $ct = $r-header_in("Content-type") || ""; return unless $ct eq "application/x-www-form-urlencoded"; my $buff; $r-read($buff, $r-header_in("Content-length")); parse_args(wantarray, $buff); } it seems that the "Content-type" must be "application/x-www-form-urlencoded" before we can get anything out of the content() routine from mod_perl :-( So i tried this #Get posted XML query $len = $Request-{TotalBytes}; $Request-{asp}-{r}-read($i,$len); this will work always without taking into acount the content-type , which is text/xml I don't know if there is any problem with doing it this way ? If anybody has a clue on this , let me know . greetings, luc Brendan McKenna wrote: Hi, The 156 bytes are your data. Since you're using Perl, you should be able to access your data using $Response-content; Brendan : : hello , : : : i'm working on a project that involves some XML-RPC system. The idea is : to POST a XML to a ASP script which will than process this : and return a XML back to the client. : : To do that a send sommething like this (output from ethereal dump) : : : POST /cp-bin/rc2.asp HTTP/1.0 : Host: linux : User-Agent: libwww-perl/5.36 : Content-Length: 156 : Content-Type: text/xml : : ?xml version="1.0"? : methodCall : methodNameexamples.getStateName/methodName : params : paramvaluei41/i4/value/param : /params : /methodCall : : The problem now is , that in the asp script i get a Totalbytes of 156 : bytes but the content string is empty ? : : #Get posted XML query : my $len = $Request-{TotalBytes}; : my $i = $Request-BinaryRead($len); : : #log input query : $Response-Debug("recieved $len bytes"); : $Response-Debug("data [$i]"); : : Does anybody has a clue where the 156 bytes are ??? : : thanks : luc willems : : - : To unsubscribe, e-mail: [EMAIL PROTECTED] : For additional commands, e-mail: [EMAIL PROTECTED] : -- Brendan McKenna Technical Director Phone: +353-(0)61-338177 x4143 W3 Services Ltd. Fax: +353-(0)61-338065 Innovation Centre Email: [EMAIL PROTECTED] National Technological Park Limerick Ireland - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Apache::ASP problem with post data
Luc Willems wrote: hello , i'm working on a project that involves some XML-RPC system. The idea is to POST a XML to a ASP script which will than process this and return a XML back to the client. To do that a send sommething like this (output from ethereal dump) : POST /cp-bin/rc2.asp HTTP/1.0 Host: linux User-Agent: libwww-perl/5.36 Content-Length: 156 Content-Type: text/xml ?xml version="1.0"? methodCall methodNameexamples.getStateName/methodName params paramvaluei41/i4/value/param /params /methodCall The problem now is , that in the asp script i get a Totalbytes of 156 bytes but the content string is empty ? I don't know why this is happening. Everything looks like it should work fine. Can you write a mini Apache::Registry script with the same call to it, and do: print Apache-content(); In Apache::ASP, content is initialized like: $self-{content} = $r-content(); very straightforward, so if the above shows content, but Apache::ASP isn't getting any, I'll be a little stumped. Also, what is the output from: %= $Request-BinaryRead() % which should return all of the output. Your other code should have worked, but just in case. BinaryRead w/o a length just returns all of it. This shouldn't be the problem, but is there the chance that there is something else calling $r-content() first? Maybe some other code in another PerlHandler stage? This should not be the problem because one would expect your script to hang in this case, but again I'm a bit stumped. -- Josh _ Joshua Chamas Chamas Enterprises Inc. NodeWorks free web link monitoring Huntington Beach, CA USA http://www.nodeworks.com1-714-625-4051 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]