AnantLabs / google-enterprise-connector-sharepoint

Automatically exported from code.google.com/p/google-enterprise-connector-sharepoint
0 stars 0 forks source link

Google Searchbox - Cookies need to be encoded #82

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Received error: Part of the cookie is invalid

Prior to creating HTTP Request to GSA cookies are not being encoded.

Encoding iso = Encoding.GetEncoding("UTF-8
value = HttpUtility.UrlEncode(value, iso);

Original issue reported on code.google.com by mbciz...@yahoo.com on 23 Jul 2009 at 3:30

GoogleCodeExporter commented 9 years ago
Can you share the details of the scenario(s) where you are getting this error? 
This
will help us to have the issue reproduced at our end.

Original comment by amit.per...@gmail.com on 24 Jul 2009 at 5:31

GoogleCodeExporter commented 9 years ago
I received the error:

Part of the cookie is invalid.

I narrowed down the error to where you are reading the cookies from the client 
and 
passing them to the GSA.  These cookies need to be url encoded.  You should use 
the 
HttpUtility.UrlEncode with something like "UTF-8" to encode cookies prior to 
sending 
them to the GSA.  I did that in the code and no longer received the error.  I 
found 
this article which helped me narrow down the issue.

http://social.msdn.microsoft.com/forums/en-US/netfxnetcom/thread/ab33e2c8-c3ea-4
3d0-
ac30-1b98916fd068

Original comment by mbciz...@yahoo.com on 24 Jul 2009 at 4:35

GoogleCodeExporter commented 9 years ago

Original comment by rakeshs101981@gmail.com on 2 Sep 2009 at 10:52

GoogleCodeExporter commented 9 years ago

Original comment by rakeshs101981@gmail.com on 25 Sep 2009 at 2:12

GoogleCodeExporter commented 9 years ago
I managed to create a workaround by editing the Cookie string separators.

Edit searchresults.apx in  C:\Program Files\Common Files\Microsoft Shared\web 
server 
extensions\12\TEMPLATE\LAYOUTS

Search for:  Char[] seps = {'='};//Adding the session cookie
Modify to:  Char[] seps = {'=',';'};//Adding the session cookie

Original comment by xen.lategan on 18 Jan 2010 at 11:39

GoogleCodeExporter commented 9 years ago
I believe the cookies should be encoded in all cases, no?

Original comment by sales%mc...@gtempaccount.com on 18 Jan 2010 at 3:39

GoogleCodeExporter commented 9 years ago
Can you provide specific details of the problems? Th cookie seems to be encoded:

http://code.google.com/p/google-enterprise-connector-
sharepoint/source/browse/tags/GSBS-1.1.1/searchresults.aspx

Code snippet:
==============

responseCookies.Name = objResp.Cookies[j].Name;
Encoding utf8 = Encoding.GetEncoding("utf-8");
string value = objResp.Cookies[j].Value;
responseCookies.Value = HttpUtility.UrlEncode(value, utf8); 
responseCookies.Domain = objReq.RequestUri.Host;
responseCookies.Expires = objResp.Cookies[j].Expires;

Original comment by rakeshs101981@gmail.com on 21 Jan 2010 at 8:23

GoogleCodeExporter commented 9 years ago
Fix Details
============
http://code.google.com/p/google-enterprise-connector-sharepoint/source/detail?r=
625

Original comment by amit.per...@gmail.com on 11 Mar 2010 at 4:36

GoogleCodeExporter commented 9 years ago
Problem:
=========
When adding a Cookie, the cookie may or may not have a value. Search Box should
handle such cases  E.g. GSA_SESSION_ID=7d8b50eb55a1c077159657da24e5b71d; secure
In this e.g. 'secure' cookie does not have any value.

Solution:
========
Check if the cookie contains '='(i.e. cookie key-value separator). If so get the
value else keep it empty.

Fix revision:
==============
http://code.google.com/p/google-enterprise-connector-sharepoint/source/detail?r=
628

Original comment by amit.per...@gmail.com on 11 Mar 2010 at 10:13

GoogleCodeExporter commented 9 years ago

Original comment by amit.per...@gmail.com on 17 Jun 2010 at 8:55