]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
http server: RTSP Session header cleanups, add more RTSP status codes
authorJaroslav Kysela <perex@perex.cz>
Tue, 3 Mar 2015 15:03:23 +0000 (16:03 +0100)
committerJaroslav Kysela <perex@perex.cz>
Wed, 11 Mar 2015 20:41:12 +0000 (21:41 +0100)
src/http.c
src/http.h

index be0ac00f6e138f97dbee1c48bdb6f087e8aed028..eab13d04c465c5f3721ce92da1421c63bd0a4050 100644 (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;
 }
 
index 30ce1e5f5cef9bf7b1e8fb163cd287535367c1da..71ea02b0708f36d4fae1047210b9c81d70eadb0e 100644 (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