Has anyone had issues with ns_parseheader or _ns_http_gets. I have a
function that pulls an XML document from another server and it returns

httppost invalid header:  HTTP/1.1 200 OK

Every now and then under load. I'm running aol33.

In looking at the C code it appears ns_parseheader is expecting an ns_set
and headers excluding the status line. The code is from acs and does

set http [util_httpopen POST $url "" $timeout $http_referer]
        set rfd [lindex $http 0]
        set wfd [lindex $http 1]

        #headers necesary for a post and the form variables

        _ns_http_puts $timeout $wfd "Content-type:
application/x-www-form-urlencoded \r"
        _ns_http_puts $timeout $wfd "Content-length: [string length
$formvars]\r"
        _ns_http_puts $timeout $wfd \r
        _ns_http_puts $timeout $wfd "$formvars\r"
        flush $wfd
        close $wfd

        set rpset [ns_set new [_ns_http_gets $timeout $rfd]]
                while 1 {
                        set line [_ns_http_gets $timeout $rfd]
                        if ![string length $line] break
                        ns_parseheader $rpset $line
                }
        set headers $rpset
        set response [ns_set name $headers]
        set status [lindex $response 1]

So I guess what this does is create a set named by the status line???, then
for each header line call ns_parseheader. It appears the first _ns_http_gets
is not getting the status line from the response causing ns_parseheader to
blow up. I've verified this by adding

        set n [_ns_http_gets $timeout $rfd]
        ds_comment $n
        ns_log ERROR "httppost %$n%"
        if { $n == "" } {
                set n [_ns_http_gets $timeout $rfd]
                ds_comment $n
                ns_log ERROR "httppost2 %$n%"
        }

The strange this is _ns_http_gets should not return a empty string.

Barry Books


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> with the
body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of 
your email blank.

Reply via email to