mirror of
https://github.com/pikvm/ustreamer.git
synced 2026-03-01 05:06:32 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8fa6db0be1 | ||
|
|
d57e9864a4 |
@@ -1,7 +1,7 @@
|
|||||||
[bumpversion]
|
[bumpversion]
|
||||||
commit = True
|
commit = True
|
||||||
tag = True
|
tag = True
|
||||||
current_version = 0.34
|
current_version = 0.35
|
||||||
parse = (?P<major>\d+)\.(?P<minor>\d+)(\.(?P<patch>\d+)(\-(?P<release>[a-z]+))?)?
|
parse = (?P<major>\d+)\.(?P<minor>\d+)(\.(?P<patch>\d+)(\-(?P<release>[a-z]+))?)?
|
||||||
serialize =
|
serialize =
|
||||||
{major}.{minor}
|
{major}.{minor}
|
||||||
|
|||||||
2
PKGBUILD
2
PKGBUILD
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
|
|
||||||
pkgname=ustreamer
|
pkgname=ustreamer
|
||||||
pkgver=0.34
|
pkgver=0.35
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="Lightweight and fast MJPG-HTTP streamer"
|
pkgdesc="Lightweight and fast MJPG-HTTP streamer"
|
||||||
url="https://github.com/pi-kvm/ustreamer"
|
url="https://github.com/pi-kvm/ustreamer"
|
||||||
|
|||||||
@@ -21,4 +21,4 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define VERSION "0.34"
|
#define VERSION "0.35"
|
||||||
|
|||||||
15
src/http.c
15
src/http.c
@@ -48,6 +48,7 @@
|
|||||||
|
|
||||||
|
|
||||||
static bool _http_get_param_true(struct evkeyvalq *params, const char *key);
|
static bool _http_get_param_true(struct evkeyvalq *params, const char *key);
|
||||||
|
static char *_http_get_param_uri(struct evkeyvalq *params, const char *key);
|
||||||
|
|
||||||
static void _http_callback_root(struct evhttp_request *request, void *arg);
|
static void _http_callback_root(struct evhttp_request *request, void *arg);
|
||||||
static void _http_callback_ping(struct evhttp_request *request, void *v_server);
|
static void _http_callback_ping(struct evhttp_request *request, void *v_server);
|
||||||
@@ -157,6 +158,15 @@ static bool _http_get_param_true(struct evkeyvalq *params, const char *key) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *_http_get_param_uri(struct evkeyvalq *params, const char *key) {
|
||||||
|
const char *value_str;
|
||||||
|
|
||||||
|
if ((value_str = evhttp_find_header(params, key)) != NULL) {
|
||||||
|
return evhttp_encode_uri(value_str);
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
#define ADD_HEADER(_key, _value) \
|
#define ADD_HEADER(_key, _value) \
|
||||||
assert(!evhttp_add_header(evhttp_request_get_output_headers(request), _key, _value))
|
assert(!evhttp_add_header(evhttp_request_get_output_headers(request), _key, _value))
|
||||||
|
|
||||||
@@ -292,6 +302,7 @@ static void _http_callback_stream(struct evhttp_request *request, void *v_server
|
|||||||
client->need_first_frame = true;
|
client->need_first_frame = true;
|
||||||
|
|
||||||
evhttp_parse_query(evhttp_request_get_uri(request), ¶ms);
|
evhttp_parse_query(evhttp_request_get_uri(request), ¶ms);
|
||||||
|
client->key = _http_get_param_uri(¶ms, "key");
|
||||||
client->extra_headers = _http_get_param_true(¶ms, "extra_headers");
|
client->extra_headers = _http_get_param_true(¶ms, "extra_headers");
|
||||||
client->advance_headers = _http_get_param_true(¶ms, "advance_headers");
|
client->advance_headers = _http_get_param_true(¶ms, "advance_headers");
|
||||||
client->dual_final_frames = _http_get_param_true(¶ms, "dual_final_frames");
|
client->dual_final_frames = _http_get_param_true(¶ms, "dual_final_frames");
|
||||||
@@ -381,10 +392,11 @@ static void _http_callback_stream_write(struct bufferevent *buf_event, void *v_c
|
|||||||
"Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0" RN
|
"Cache-Control: no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0" RN
|
||||||
"Pragma: no-cache" RN
|
"Pragma: no-cache" RN
|
||||||
"Expires: Mon, 3 Jan 2000 12:34:56 GMT" RN
|
"Expires: Mon, 3 Jan 2000 12:34:56 GMT" RN
|
||||||
"Set-Cookie: stream_client_id=%s; path=/; max-age=30" RN
|
"Set-Cookie: stream_client_key=%s; stream_client_id=%s; path=/; max-age=30" RN
|
||||||
"Content-Type: multipart/x-mixed-replace;boundary=" BOUNDARY RN
|
"Content-Type: multipart/x-mixed-replace;boundary=" BOUNDARY RN
|
||||||
RN
|
RN
|
||||||
"--" BOUNDARY RN,
|
"--" BOUNDARY RN,
|
||||||
|
(client->key != NULL ? client->key : "0"),
|
||||||
client->id
|
client->id
|
||||||
));
|
));
|
||||||
|
|
||||||
@@ -486,6 +498,7 @@ static void _http_callback_stream_error(UNUSED struct bufferevent *buf_event, UN
|
|||||||
if (client->next != NULL) {
|
if (client->next != NULL) {
|
||||||
client->next->prev = client->prev;
|
client->next->prev = client->prev;
|
||||||
}
|
}
|
||||||
|
free(client->key);
|
||||||
free(client);
|
free(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ struct stream_client_t {
|
|||||||
struct http_server_t *server;
|
struct http_server_t *server;
|
||||||
struct evhttp_request *request;
|
struct evhttp_request *request;
|
||||||
|
|
||||||
|
char *key;
|
||||||
bool extra_headers;
|
bool extra_headers;
|
||||||
bool advance_headers;
|
bool advance_headers;
|
||||||
bool dual_final_frames;
|
bool dual_final_frames;
|
||||||
|
|||||||
Reference in New Issue
Block a user