diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-01-17 21:31:56 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-01-17 21:31:56 +0000 |
commit | dedde188e696656e16d157fa2ed2f5c04e2ce5f7 (patch) | |
tree | abc75333971e159af65497a3b700316c0e80744d /main | |
parent | 170cf6ed74a1c273d69698a424373d5ef6db0815 (diff) |
we should only send the Set-Cookie header to the browser on the first response after creating a manager session, not on every response (doing so causes the browser to clear any local cookies it may have associated with the session)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@99001 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r-- | main/manager.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/main/manager.c b/main/manager.c index 8e3309667..1b1687408 100644 --- a/main/manager.c +++ b/main/manager.c @@ -2639,6 +2639,7 @@ static char *generic_http_callback(int format, struct sockaddr_in *requestor, co char *c = workspace; char *retval = NULL; struct ast_variable *v; + unsigned int new_session = 0; for (v = params; v; v = v->next) { if (!strcasecmp(v->name, "mansession_id")) { @@ -2670,6 +2671,7 @@ static char *generic_http_callback(int format, struct sockaddr_in *requestor, co ast_atomic_fetchadd_int(&s->eventq->usecount, 1); ast_atomic_fetchadd_int(&num_sessions, 1); AST_LIST_UNLOCK(&sessions); + new_session = 1; } /* Reset HTTP timeout. If we're not yet authenticated, keep it extremely short */ @@ -2710,8 +2712,10 @@ static char *generic_http_callback(int format, struct sockaddr_in *requestor, co s->needdestroy = 1; } ast_build_string(&c, &len, "Content-type: text/%s\r\n", contenttype[format]); - sprintf(tmp, "%08lx", s->managerid); - ast_build_string(&c, &len, "%s\r\n", ast_http_setcookie("mansession_id", tmp, httptimeout, cookie, sizeof(cookie))); + if (new_session) { + sprintf(tmp, "%08lx", s->managerid); + ast_build_string(&c, &len, "%s\r\n", ast_http_setcookie("mansession_id", tmp, httptimeout, cookie, sizeof(cookie))); + } if (format == FORMAT_HTML) ast_build_string(&c, &len, "<title>Asterisk™ Manager Interface</title>"); if (format == FORMAT_XML) { |