|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Set-Cookie header issueHi, I am trying to get the "Set-Cookie" value from the http response but I am unable to see if for some reason. I am able to see other header values and this http response object does have the "Set-Cookie" field, I confirmed it via httpheaders in firefox and also enabled cookie debugging via Grinder.properties file. here is part of my code: Please tell me if I am doing something wrong. from HTTPClient import NVPair, HTTPResponse import HTTPClient.Cookie as mycookie connectionDefaults = HTTPPluginControl.getConnectionDefaults() httpUtilities = HTTPPluginControl.getHTTPUtilities() CookiePolicy.setDefaultPolicy(CookiePolicy.COMPATIBILITY) ........ ........ result = request101.GET('/portal') sessionid=result.getHeader('Set-Cookie') print "My cookie", sessionid Output: none if I change it to sessionid=result.getHeader('Server') print "My server", sessionid OutPut: Web Server --------------- My headers as shown in Firefox: HTTP/1.x 200 OK Date: Fri, 23 May 2008 21:34:37 GMT Server: Web Server Set-Cookie: JSESSIONID=7CE1D78313AD4BF2B7300C9BC5107CDF.xxxxxxxxxxxxxx; Path=/; Secure X-Powered-By: Servlet 2.4; JBoss-4.2.0.GA (build: SVNTag=JBPAPP_4_2_0_GA date=200706281411)/Tomcat-5.5 Content-Length: 411 Keep-Alive: timeout=5, max=100 Connection: Keep-Alive Content-Type: text/html;charset=UTF-8 -------------- So why is "result.getHeader('Set-Cookie')" not showing me anything, am I doing something wrong? Please help. Thanks ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ grinder-use mailing list grinder-use@... https://lists.sourceforge.net/lists/listinfo/grinder-use |
|
|
|
|
|
Re: Set-Cookie header issueThe Grinder automatically handles the cookie headers and strips them
from those available to the script. The Cookies are then available through the CookieModule API. See http://grinder.sourceforge.net/g3/script-gallery.html#cookies If you want to disable the automatic handling of cookies entirely you could do the following. The Grinder will then not remove the Set-Cookie headers and you can access the directly. (You would of course then have to handle any session tracking cookies you are using yourself). from net.grinder.plugin.http import HTTPPluginControl HTTPPluginControl.getConnectionDefaults().useCookies = 1 - Phil anil_jacob@... wrote: > I believe this could be caused by HTTPS, since the url used to access the server is https. > To debug I used a small python script which does the same using httplib. > > If I use > > conn = httplib.HTTPSConnection(host, 443) --- it connects to the server but shows no cookie. > conn.request('GET', '/portal') > resp = conn.getresponse() > print "Cookie:", resp.getheader('Set-Cookie') > > Cookie: None > > > ------------------------------------------- > if I use > conn = httplib.HTTPSConnection(host) > conn.request('GET', '/portal') > resp = conn.getresponse() > print "Cookie:", resp.getheader('Set-Cookie') > > Cookie: JSESSIONID=BD4257CCB1F8D23955E7106F308CE58F > > So going to Grinder, Does Grinder's SSL implementation have anything to do with the below issue? > > Thanks > > > -------------- Original message ---------------------- > From: anil_jacob@... > >> Hi, >> >> I am trying to get the "Set-Cookie" value from the http response but I am unable >> to see if for some reason. I am able to see other header values and this http >> response object does have the "Set-Cookie" field, I confirmed it via httpheaders >> in firefox and also enabled cookie debugging via Grinder.properties file. >> >> >> here is part of my code: Please tell me if I am doing something wrong. >> >> from HTTPClient import NVPair, HTTPResponse >> import HTTPClient.Cookie as mycookie >> connectionDefaults = HTTPPluginControl.getConnectionDefaults() >> httpUtilities = HTTPPluginControl.getHTTPUtilities() >> CookiePolicy.setDefaultPolicy(CookiePolicy.COMPATIBILITY) >> ........ >> ........ >> >> result = request101.GET('/portal') >> sessionid=result.getHeader('Set-Cookie') >> print "My cookie", sessionid >> >> Output: none >> >> if I change it to >> sessionid=result.getHeader('Server') >> print "My server", sessionid >> >> OutPut: Web Server >> >> --------------- >> >> My headers as shown in Firefox: >> >> HTTP/1.x 200 OK >> Date: Fri, 23 May 2008 21:34:37 GMT >> Server: Web Server >> Set-Cookie: JSESSIONID=7CE1D78313AD4BF2B7300C9BC5107CDF.xxxxxxxxxxxxxx; Path=/; >> Secure >> X-Powered-By: Servlet 2.4; JBoss-4.2.0.GA (build: SVNTag=JBPAPP_4_2_0_GA >> date=200706281411)/Tomcat-5.5 >> Content-Length: 411 >> Keep-Alive: timeout=5, max=100 >> Connection: Keep-Alive >> Content-Type: text/html;charset=UTF-8 >> >> -------------- >> >> So why is "result.getHeader('Set-Cookie')" not showing me anything, am I doing >> something wrong? >> >> Please help. >> >> Thanks >> >> Notice: This email message, together with any attachments, may contain information of BEA Systems, Inc., its subsidiaries and affiliated entities, that may be confidential, proprietary, copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by email and then delete it. ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ grinder-use mailing list grinder-use@... https://lists.sourceforge.net/lists/listinfo/grinder-use |
| Free Forum Powered by Nabble | Forum Help |