X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=server.cpp;h=4773b479b92047b0be10f87095e14605799e4db1;hp=5c1f31bef451300f5cdf335261a7c9fd2aaedbae;hb=980ac162414c9fce62af4fdb9cfc282865b31572;hpb=cb042ee88b5f4cd6e5f55bada4d9d86807f1640b;ds=inline diff --git a/server.cpp b/server.cpp index 5c1f31b..4773b47 100644 --- a/server.cpp +++ b/server.cpp @@ -458,26 +458,7 @@ void Server::set_header(int stream_index, const string &http_header, const strin { lock_guard lock(mu); assert(stream_index >= 0 && stream_index < ssize_t(streams.size())); - Stream *stream = streams[stream_index].get(); - stream->http_header = http_header; - - if (stream_header != stream->stream_header) { - // We cannot start at any of the older starting points anymore, - // since they'd get the wrong header for the stream (not to mention - // that a changed header probably means the stream restarted, - // which means any client starting on the old one would probably - // stop playing properly at the change point). Next block - // should be a suitable starting point (if not, something is - // pretty strange), so it will fill up again soon enough. - stream->suitable_starting_points.clear(); - - if (!stream->fragments.empty()) { - stream->fragments.clear(); - ++stream->discontinuity_counter; - stream->clear_hls_playlist_cache(); - } - } - stream->stream_header = stream_header; + streams[stream_index]->set_header(http_header, stream_header); } void Server::set_pacing_rate(int stream_index, uint32_t pacing_rate) @@ -1116,9 +1097,6 @@ int Server::parse_request(Client *client) } Stream *stream = client->stream; - if (stream->http_header.empty()) { - return 503; // Service unavailable. - } if (client->serving_hls_playlist) { if (stream->encoding == Stream::STREAM_ENCODING_METACUBE) { @@ -1130,6 +1108,10 @@ int Server::parse_request(Client *client) } if (client->stream_pos_end == Client::STREAM_POS_NO_END) { + if (stream->http_header.empty()) { + return 503; // Service unavailable. + } + // This stream won't end, so we don't have a content-length, // and can just as well tell the client it's Connection: close // (otherwise, we'd have to implement chunking TE for no good reason).