Open xiaotianrandom opened 6 years ago
I change ", "
to "; "
in the line https://github.com/processone/tsung/blob/v1.7.0/src/lib/mochiweb_headers.erl#L257 to workaround this issue. But this is only a hack.
Maybe there should be a dedicated way to access response cookie
s which takes into account.
I was also wondering if it would be a good idea, to have some sort of mechanism to ask tsung's cookie jar for information. This way we could also get a value, that represents what tsung understood.
That said, I haven't fully understood how Set-Cookie/sessionid
works at all ^^ Still reading the cookie handling code…
@xiaotianrandom do you have an example of how you worked around this?
You can find my patch to work around this here. Note that it's only a hack and not thoroughly tested.
Okay thanks, that work-around/hack is working for me.
I want to get the session cookie from a login response. Is there a way to get a cookie and use it in subsequent requests?
I notice that dynvars can read response headers via
<dyn_variable name="..." header="..."/>
. But this is not appropriate for cookies, because there may be multipleSet-Cookie
headers. These headers are concatenated bymochiweb_headers:get_value
, making subsequent parsing failed.For example,
POST /api/login
on my website sets the following cookies on a successful login:And my config looks like:
It fails to set the dynvar
sessionid
toAAA
. The reason is thatmochiweb_headers:get_value
concatenates the two headers by", "
:and the subsequent
parse_header(SubV, ";")
gets an itemPath=/, sessionid=AAA
instead ofsessionid=AAA
.