Skip to content

Commit

Permalink
Update for version 4.3.2 (#1233)
Browse files Browse the repository at this point in the history
* Update for version 4.3.2
  • Loading branch information
Mr-DaveDev authored Oct 25, 2020
1 parent f042807 commit d603c62
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 80 deletions.
15 changes: 2 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,11 @@ matrix:
language: c
compiler: gcc
- os: linux
env: DOCKER_IMAGE=ubuntu:19.04
env: DOCKER_IMAGE=ubuntu:20.04
services: docker
language: c
compiler: gcc
- os: linux
env: DOCKER_IMAGE=debian:jessie
services: docker
language: c
compiler: gcc
- os: linux
- os: linux
env: DOCKER_IMAGE=debian:stretch
services: docker
language: c
Expand Down Expand Up @@ -78,12 +73,6 @@ before_script:
docker exec $(docker ps -aq) /bin/bash -c 'apt-get install -y libavformat-dev libavcodec-dev libavutil-dev libswscale-dev libavdevice-dev';
docker exec $(docker ps -aq) /bin/bash -c 'apt-get install -y libsqlite3-dev libpq-dev libmariadbclient-dev libwebp-dev libmicrohttpd-dev gettext';
docker exec $(docker ps -aq) /bin/bash -c 'autoreconf -fiv';
elif [ "$DOCKER_IMAGE" = "debian:jessie" ]; then
docker exec $(docker ps -aq) /bin/bash -c 'apt-get -qq update';
docker exec $(docker ps -aq) /bin/bash -c 'apt-get install -y build-essential libjpeg62-turbo-dev libzip-dev autoconf automake autopoint pkgconf libtool git';
docker exec $(docker ps -aq) /bin/bash -c 'apt-get install -y libavformat-dev libavcodec-dev libavutil-dev libswscale-dev libavdevice-dev';
docker exec $(docker ps -aq) /bin/bash -c 'apt-get install -y libsqlite3-dev libpq-dev libmysqlclient-dev libwebp-dev libmicrohttpd-dev gettext';
docker exec $(docker ps -aq) /bin/bash -c 'autoreconf -fiv';
elif [ "$DOCKER_IMAGE" = "ubuntu:16.04" ]; then
docker exec $(docker ps -aq) /bin/bash -c 'apt-get -qq update';
docker exec $(docker ps -aq) /bin/bash -c 'apt-get install -y build-essential libjpeg8-dev libzip-dev autoconf automake autopoint pkgconf libtool git';
Expand Down
12 changes: 12 additions & 0 deletions doc/CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
Summary of changes for version 4.3.2 are below
* Revise to use MHD function for url decode
* Update travis distribution testing
* Eliminate compiler warnings on unsigned comparisons
* Eliminate compiler warnings on MHD return codes
Summary of changes for version 4.3.1 are below
* Compiler errors with GCC 10
* Overrides to CFLAGS
* Add maintainer mode
* Segfault when invalid camera directory specified
* MariaDB initializations
* Updated guide
Summary of changes for version 4.3.0 are below
* Implement default for non ascii characters
* Removed poll requirement for MHD
Expand Down
2 changes: 1 addition & 1 deletion scripts/version.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
BASE_VERSION="4.3.1"
BASE_VERSION="4.3.2"
if [ -d .git ]; then
if test "`git diff --name-only`" = "" ; then
GIT_COMMIT="git"
Expand Down
6 changes: 4 additions & 2 deletions src/ffmpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -697,9 +697,11 @@ static const char *ffmpeg_codec_is_blacklisted(const char *codec_name){
{"h264_v4l2m2m", "FFMpeg version is too old"},
#endif
};
size_t i;
size_t i,i_mx;

for (i = 0; i < sizeof(blacklisted_codec)/sizeof(blacklisted_codec[0]); i++) {
i_mx = (size_t)(sizeof(blacklisted_codec)/sizeof(blacklisted_codec[0]));

for (i = 0; i < i_mx; i++) {
if (strcmp(codec_name, blacklisted_codec[i].codec_name) == 0)
return blacklisted_codec[i].reason;
}
Expand Down
72 changes: 8 additions & 64 deletions src/webu.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ struct mhdstart_ctx {
struct sockaddr_in6 lpbk_ipv6;
};

#if MHD_VERSION >= 0x00097002
typedef enum MHD_Result mymhd_retcd;
#else
typedef int mymhd_retcd;
#endif

static void webu_context_init(struct context **cntlst, struct context *cnt, struct webui_ctx *webui) {

Expand Down Expand Up @@ -225,66 +230,6 @@ void webu_write(struct webui_ctx *webui, const char *buf) {
return;
}

static int webu_url_decode(char *urlencoded, size_t length) {
/* We are sent a URI encoded string and this decodes it to characters
* If the sent URL that isn't valid, then we clear out the URL
* so it is not processed in further functions. The "answer" functions
* look for empty urls and answer with bad request
*/
char *data = urlencoded;
char *urldecoded = urlencoded;
int scan_rslt;
size_t origlen;

origlen = length;

if (urlencoded[0] != '/'){
MOTION_LOG(ERR, TYPE_STREAM, NO_ERRNO, _("Invalid url: %s"),urlencoded);
memset(urlencoded,'\0',origlen);
return -1;
}

while (length > 0) {
if (*data == '%') {
char c[3];
int i;
data++;
length--;
c[0] = *data++;
length--;
c[1] = *data;
c[2] = 0;

scan_rslt = sscanf(c, "%x", &i);
if (scan_rslt < 1){
MOTION_LOG(ERR, TYPE_STREAM, NO_ERRNO,_("Error decoding url"));
memset(urlencoded,'\0',origlen);
return -1;
}

if (i < 128) {
*urldecoded++ = (char)i;
} else {
*urldecoded++ = '%';
*urldecoded++ = c[0];
*urldecoded++ = c[1];
}

} else if (*data == '<' || *data == '+' || *data == '>') {
*urldecoded++ = ' ';
} else {
*urldecoded++ = *data;
}

data++;
length--;
}
*urldecoded = '\0';

return 0;

}

static void webu_parms_edit(struct webui_ctx *webui) {

/* Determine the thread number provided.
Expand Down Expand Up @@ -471,8 +416,7 @@ static int webu_parseurl(struct webui_ctx *webui) {

if (strlen(webui->url) == 0) return -1;

retcd = webu_url_decode(webui->url, strlen(webui->url));
if (retcd != 0) return retcd;
MHD_http_unescape(webui->url);

MOTION_LOG(DBG, TYPE_STREAM, NO_ERRNO, _("Decoded url: %s"),webui->url);

Expand Down Expand Up @@ -1203,7 +1147,7 @@ static void webu_answer_strm_type(struct webui_ctx *webui) {

}

static int webu_answer_ctrl(void *cls
static mymhd_retcd webu_answer_ctrl(void *cls
, struct MHD_Connection *connection
, const char *url
, const char *method
Expand Down Expand Up @@ -1275,7 +1219,7 @@ static int webu_answer_ctrl(void *cls

}

static int webu_answer_strm(void *cls
static mymhd_retcd webu_answer_strm(void *cls
, struct MHD_Connection *connection
, const char *url
, const char *method
Expand Down

0 comments on commit d603c62

Please sign in to comment.