-
-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cookie parsing behave differently in windows #172
Comments
You can remove :WINDOWS from I looked through the cookie header generating code for winhttp and didn't see anything obviously wrong, but I don't have a windows machine to play with right now... |
yes. I figured :windows only appear if you load cl+ssl and although it's a dependency of dexador you have to load it first. Also you have to make sure it knows the platform (that being you can't remove features like :os-windows and :win32) Although it's ugly my temporary way to solve this is to load cl+ssl -> pop :windows -> then load dexador. It's hella mess and also sbcl would throws error while ccl doesn't. this is not a good solution by any means. |
Hmm, maybe it's better to have dedicated systems for each backend for manual choice, such as dexador-usocket.asd. |
personally I think having something like then again the issue above is pretty strange. I'm curious whether someone else that has a windows machine can reproduce the same error. |
I added "dexador-usocket" system for loading the usocket backend explicitly. |
But here's what I've found after taking some time to debug winhttp:
(CL-COOKIE:PARSE-SET-COOKIE-HEADER
"acw_tc=2760824617166543460375131ed5fcdba3997b40c5ad050ab4fa9b810ba6ac;path=/;HttpOnly;Max-Age=1800"
"welearn.sflep.com" "/user/prelogin.aspx")
(CL-COOKIE:PARSE-SET-COOKIE-HEADER
"ASP.NET_SessionId=v05ejyfixyhhoqnmqm1xktjb; path=/; HttpOnly; SameSite=Lax"
"welearn.sflep.com" "/user/prelogin.aspx")
(CL-COOKIE:PARSE-SET-COOKIE-HEADER "acw_tc=2760778217166537661284226ea9877b7f9f0fc2ca81a27f34d67184102dfc;path=/;HttpOnly;Max-Age=1800, ASP.NET_SessionId=lsxoabet3qvdlsazd134szkl; path=/; HttpOnly; SameSite=Lax" "welearn.sflep.com" "/user/prelogin.aspx") In the second one, We can see that the dexador/src/backend/winhttp.lisp Line 204 in 76d5f56
Following this, I checked the value of response-headers (on line 199 or the same thing on line#694 in usocket.lisp ):dexador/src/backend/winhttp.lisp Lines 198 to 208 in 76d5f56
And surprisingly, the value of (gethash "set-cookie" response-headers) aren't the same:(As I have said, the request above contains 2 Set-cookie headers)
so this is what it should look like (a list): (acw_tc=2760776f17166522239694922e794ffe0c1c5cc101d25964e0a56a6c0eac35;path=/;HttpOnly;Max-Age=1800 ;; 1st set-cookie
ASP.NET_SessionId=v0nrawvxdex4spxdxdfcpv1t; path=/; HttpOnly;SameSite=Lax) ;; 2nd set-cookie instead of a single string "acw_tc=2760778217166537661284226ea9877b7f9f0fc2ca81a27f34d67184102dfc;path=/;HttpOnly;Max-Age=1800, ASP.NET_SessionId=lsxoabet3qvdlsazd134szkl; path=/; HttpOnly; SameSite=Lax" But How? Since the code's the same... Well I think dexador/src/backend/winhttp.lisp Lines 55 to 64 in 76d5f56
line#61 would produce that , . I guess it's a separator and changed it from , to #\newline , as the latter is not allowed in http header.
And to sum up we need to split the cookie on windows, I think. |
The above code would run just fine on *unix. But on Windows (uses WINHTTP) I tried to run the same code but get an error saying
And after tracing some function I think it's some thing related with
parse-integer
in cl-cookie, but that doesn't explain why this doesn't happen on unix. So I manually curl'd the above site:we have 2 set-cookie headers here and somehow "1800, ASP.NET_SessionId=...." are not splitted by
#\,
causingparse-integer
to apply on the whole string, which throws the exception above.The usocket one runs fine so i think it's a bug with winhttp (or some code in
winhttp.lisp
that fails to handle multipleset-cookie
headers).Meanwhile, is there a way to not use winhttp on windows?
dexador.usocket.request
kinda works but it's a internal function and I do not want to mess with that.The text was updated successfully, but these errors were encountered: