Skip to content
This repository was archived by the owner on Nov 6, 2022. It is now read-only.

Commit 921d558

Browse files
committed
parser: add support for icecast SOURCE method
Fixes: #405 PR-URL: #407 Reviewed-By: Fedor Indutny <[email protected]>
1 parent 9ce7316 commit 921d558

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

http_parser.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,7 @@ size_t http_parser_execute (http_parser *parser,
942942
/* or PROPFIND|PROPPATCH|PUT|PATCH|PURGE */
943943
break;
944944
case 'R': parser->method = HTTP_REPORT; /* or REBIND */ break;
945-
case 'S': parser->method = HTTP_SUBSCRIBE; /* or SEARCH */ break;
945+
case 'S': parser->method = HTTP_SUBSCRIBE; /* or SEARCH, SOURCE */ break;
946946
case 'T': parser->method = HTTP_TRACE; break;
947947
case 'U': parser->method = HTTP_UNLOCK; /* or UNSUBSCRIBE, UNBIND, UNLINK */ break;
948948
default:
@@ -988,6 +988,7 @@ size_t http_parser_execute (http_parser *parser,
988988
XX(MKCOL, 2, 'A', MKACTIVITY)
989989
XX(MKCOL, 3, 'A', MKCALENDAR)
990990
XX(SUBSCRIBE, 1, 'E', SEARCH)
991+
XX(SUBSCRIBE, 1, 'O', SOURCE)
991992
XX(REPORT, 2, 'B', REBIND)
992993
XX(PROPFIND, 4, 'P', PROPPATCH)
993994
XX(LOCK, 1, 'I', LINK)

http_parser.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,8 @@ enum http_status
201201
/* RFC-2068, section 19.6.1.2 */ \
202202
XX(31, LINK, LINK) \
203203
XX(32, UNLINK, UNLINK) \
204+
/* icecast */ \
205+
XX(33, SOURCE, SOURCE) \
204206

205207
enum http_method
206208
{

test.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,6 +1154,26 @@ const struct message requests[] =
11541154
,.body= ""
11551155
}
11561156

1157+
#define SOURCE_REQUEST 42
1158+
, {.name = "source request"
1159+
,.type= HTTP_REQUEST
1160+
,.raw= "SOURCE /music/sweet/music HTTP/1.1\r\n"
1161+
"Host: example.com\r\n"
1162+
"\r\n"
1163+
,.should_keep_alive= TRUE
1164+
,.message_complete_on_eof= FALSE
1165+
,.http_major= 1
1166+
,.http_minor= 1
1167+
,.method= HTTP_SOURCE
1168+
,.request_path= "/music/sweet/music"
1169+
,.request_url= "/music/sweet/music"
1170+
,.query_string= ""
1171+
,.fragment= ""
1172+
,.num_headers= 1
1173+
,.headers= { { "Host", "example.com" } }
1174+
,.body= ""
1175+
}
1176+
11571177
, {.name= NULL } /* sentinel */
11581178
};
11591179

0 commit comments

Comments
 (0)