[OpenSTA-devel] [ opensta-Bugs-1468855 ] 'LOAD RESPONSE_INFO' affected by subroutine order
Brought to you by:
dansut
From: SourceForge.net <no...@so...> - 2006-07-13 19:50:09
|
Bugs item #1468855, was opened at 2006-04-11 17:06 Message generated for change (Comment added) made by dansut You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110857&aid=1468855&group_id=10857 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Deleted >Resolution: Duplicate Priority: 5 Submitted By: John Arrowwood (jarrowwx) Assigned to: Nobody/Anonymous (nobody) Summary: 'LOAD RESPONSE_INFO' affected by subroutine order Initial Comment: This is similar to issues 433574 and 645735, and in fact is explicitly mentioned in 433574, but is being lost in the confusion because there are multiple bugs being reported at once. So, to try and help this issue get some attention, here it is in a separate bug. Regardless of whether you use PRIMARY GET URI or GET URI or PRIMARY POST URI, the following applies: If you perform the HTTP request in a subroutine, and then try to LOAD Response_Info after the subroutine finishes, or if you attempt to call a subroutine in order to perform the LOAD, either way, it errors with the familiar: HTTPRESPONSE: No data available for connection id(1) TScript::run: ERROR in TOF execution; resuming... This appears to be an issue whether the connection ID is a constant, an integer variable, or an expression. This is why I chose to raise a separate bug, since the other two seem to be focused on the use of a variable for the connection id. The use of SYNCHRONIZE REQUESTS seems to be of no value, whether performed in the calling subroutine, or the called subroutine. The wrapping of the call in an IF block also likewise does not help. It would seem to be a scope issue. It seems like once the scope of execution changes, the connection id is no longer valid. Here's hoping that helps narrow down the source of the problem. And if this could be fixed, it would enable scripts to be much better organized and maintainable. ---------------------------------------------------------------------- >Comment By: Daniel Sutcliffe (dansut) Date: 2006-07-13 15:50 Message: Logged In: YES user_id=19748 Problem deleted as there is no specific problem 'lost in confusion' here just a whole can of worms that needs addressing as a single issue. The mentioned 2 existing problems have now been merged and bug#645735 should be referenced for the status of problems in this area. Please check this FAQ: http://portal.opensta.org/faq.php?topic=NoDataForConnection Also it should be noted that this report would never have happend if the poster had followed the instruction: "Before submitting any new problem here, please check the FAQ, specifically the entry on reporting bugs" that is in bold large letters at the top of the form to submit new bugs. ---------------------------------------------------------------------- Comment By: John Arrowwood (jarrowwx) Date: 2006-04-13 14:25 Message: Logged In: YES user_id=1500024 The following demonstrates the problem: ----- BEGIN ----- Environment description "" mode http wait unit milliseconds Definitions CHARACTER*255 server CHARACTER*255 path CHARACTER*65535 headers CHARACTER*65535 body_text Code SET server = 'www.google.com' CALL Get [ '/' ] SUBROUTINE DebugRequest LOAD Response_Info Header ON 1 INTO headers LOAD Response_Info Body ON 1 INTO body_text LOG headers LOG body_text END SUBROUTINE SUBROUTINE Get [ path ] PRIMARY GET URI "http://"+server+path+" HTTP/1.0" ON 1 & HEADER "Host: "+server & ,WITH { "User-Agent: testing" } CALL DebugRequest END SUBROUTINE ----- END ----- The following DOES NOT demonstrate the problem. Notice how subtle the difference? ----- BEGIN ----- Environment description "" mode http wait unit milliseconds Definitions CHARACTER*255 server CHARACTER*255 path CHARACTER*65535 headers CHARACTER*65535 body_text Code SET server = 'www.google.com' CALL Get [ '/' ] SUBROUTINE Get [ path ] PRIMARY GET URI "http://"+server+path+" HTTP/1.0" ON 1 & HEADER "Host: "+server & ,WITH { "User-Agent: testing" } CALL DebugRequest END SUBROUTINE SUBROUTINE DebugRequest LOAD Response_Info Header ON 1 INTO headers LOAD Response_Info Body ON 1 INTO body_text LOG headers LOG body_text END SUBROUTINE ----- END ----- The only difference is subroutine declaration order! This ought to give the developers a great way to narrow down what is going on. And it may well be that fixing this will fix some other subtle and hard to reproduce bugs, as well. ---------------------------------------------------------------------- Comment By: John Arrowwood (jarrowwx) Date: 2006-04-13 13:55 Message: Logged In: YES user_id=1500024 Sample code that reproduces the issue, that can be used to debug the problem: Environment description "" mode http wait unit milliseconds Definitions ! HTTP Global Variables INTEGER connection_id CHARACTER*255 server CHARACTER*255 path CHARACTER*255 referrer CHARACTER*65535 headers CHARACTER*1024 cookie_temp CHARACTER*1024 cookie_contents CHARACTER*1024 redirect CHARACTER*65535 body_text INTEGER body_length_int CHARACTER*5 body_length_char INTEGER DEBUG CONSTANT USER_AGENT = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)" Code SET DEBUG = 1 SET server = 'www.google.com' CALL Get [ '/' ] !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! SUBROUTINE NextConnection IF ( connection_id > 0 ) THEN DISCONNECT FROM connection_id ENDIF SET connection_id = connection_id + 1 END SUBROUTINE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! SUBROUTINE CheckPath IF ( path <> redirect ) THEN IF ( redirect <> "" ) THEN LOG "Requesting: ", path LOG "Expecting: ", redirect ENDIF ENDIF END SUBROUTINE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! SUBROUTINE DebugRequest IF ( DEBUG = 1 ) THEN LOAD Response_Info Header ON connection_id INTO headers LOAD Response_Info Body ON connection_id INTO body_text LOG headers LOG body_text ENDIF END SUBROUTINE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! SUBROUTINE UpdateCookie LOAD Response_Info Header ON connection_id INTO cookie_temp, WITH "Set-Cookie,PHPSESSID" IF ( cookie_temp <> "" ) THEN SET cookie_contents = cookie_temp ENDIF END SUBROUTINE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! SUBROUTINE CheckRedirect LOAD Response_Info Header ON connection_id INTO redirect, WITH "Location" IF ( redirect = "/system_errors/please_login.php" ) THEN LOG "!!!!! Oops !!!!!" EXIT ENDIF END SUBROUTINE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! SUBROUTINE Post [ path, body_text ] CALL CheckPath CALL NextConnection SET body_length_int = ~LENGTH( body_text ) CONVERT body_length_int TO body_length_char LOG body_length_char LOG body_text PRIMARY POST URI "http://"+server+path+" HTTP/1.0" ON connection_id & HEADER "Host: "+server & ,WITH { & "User-Agent: "+USER_AGENT, & "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, " & "application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, " & "application/x-shockwave-flash, */*", & "Referer: http://"+server+referrer, & "Accept-Language: en-us", & "Content-Type: application/x-www-form-urlencoded", & "Connection: Keep-Alive", & "Content-Length: " + body_length_char, & "Pragma: no-cache", & "Cookie: "+cookie_contents & } & ,BODY body_text CALL DebugRequest CALL CheckRedirect SET referrer = path END SUBROUTINE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! SUBROUTINE Get [ path ] CALL CheckPath CALL NextConnection PRIMARY GET URI "http://"+server+path+" HTTP/1.0" ON connection_id & HEADER "Host: "+server & ,WITH { & "User-Agent: "+USER_AGENT, & "Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, " & "application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, " & "application/x-shockwave-flash, */*", & "Referer: http://"+server+referrer, & "Accept-Language: en-us", & "Connection: Keep-Alive", & "Pragma: no-cache", & "Cookie: "+cookie_contents & } CALL DebugRequest CALL CheckRedirect SET referrer = path END SUBROUTINE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! SUBROUTINE RefersTo [ path ] CALL NextConnection GET URI "http://"+server+path+" HTTP/1.0" ON connection_id & HEADER "Host: "+server & ,WITH { & "User-Agent: "+USER_AGENT, & "Accept: */*", & "Referer: http://"+server+referrer, & "Accept-Language: en-us", & "Connection: Keep-Alive", & "Cookie: "+cookie_contents & } END SUBROUTINE ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110857&aid=1468855&group_id=10857 |