http server: RTSP Session header cleanups, add more RTSP status codes

This commit is contained in:
Jaroslav Kysela 2015-03-03 16:03:23 +01:00
parent d90bc3ebd3
commit ca0a703779
2 changed files with 10 additions and 3 deletions

View file

@ -221,6 +221,7 @@ http_send_header(http_connection_t *hc, int rc, const char *content,
htsbuf_queue_t hdrs;
http_arg_t *ra;
time_t t;
int sess = 0;
htsbuf_queue_init(&hdrs, 0);
@ -293,13 +294,16 @@ http_send_header(http_connection_t *hc, int rc, const char *content,
if (++hc->hc_cseq == 0)
hc->hc_cseq = 1;
}
if(hc->hc_session)
htsbuf_qprintf(&hdrs, "Session: %s\r\n", hc->hc_session);
if (args) {
TAILQ_FOREACH(ra, args, link)
TAILQ_FOREACH(ra, args, link) {
if (strcmp(ra->key, "Session") == 0)
sess = 1;
htsbuf_qprintf(&hdrs, "%s: %s\r\n", ra->key, ra->val);
}
}
if(hc->hc_session && !sess)
htsbuf_qprintf(&hdrs, "Session: %s\r\n", hc->hc_session);
htsbuf_qprintf(&hdrs, "\r\n");
@ -749,6 +753,7 @@ process_request(http_connection_t *hc, htsbuf_queue_t *spill)
}
free(hc->hc_representative);
free(hc->hc_session);
hc->hc_session = NULL;
return rval;
}

View file

@ -76,6 +76,8 @@ typedef struct http_arg {
#define HTTP_STATUS_EXPECTATION 418
#define HTTP_STATUS_BANDWIDTH 453
#define HTTP_STATUS_BAD_SESSION 454
#define HTTP_STATUS_METHOD_INVALID 455
#define HTTP_STATUS_BAD_TRANSFER 456
#define HTTP_STATUS_INTERNAL 500
#define HTTP_STATUS_NOT_IMPLEMENTED 501
#define HTTP_STATUS_BAD_GATEWAY 502