Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
http server: RTSP Session header cleanups, add more RTSP status codes
  • Loading branch information
perexg committed Mar 11, 2015
1 parent d90bc3e commit ca0a703
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/http.c
Expand Up @@ -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);

Expand Down Expand Up @@ -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");

Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 2 additions & 0 deletions src/http.h
Expand Up @@ -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
Expand Down

0 comments on commit ca0a703

Please sign in to comment.