Skip to content

Commit

Permalink
Bump v2.5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
silvioprog committed Mar 20, 2020
1 parent b8204bf commit 898209f
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 21 deletions.
32 changes: 31 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,34 @@
2019-12-05 silvioprog <silvioprog@gmail.com>
2020-03-19 silvioprog <silvioprog@gmail.com>

Bump v2.5.5

2020-03-12 silvioprog <silvioprog@gmail.com>

Removed experimental feature "sg_httpsrv_process()". (issue #9)

Added experimental feature "sg_httpsrv_process()".

Moved the error handling logic to the server.

Bump v2.5.4

2020-03-11 silvioprog <silvioprog@gmail.com>

Forced the clients to leave from the server when it is shutting down.

Removed the PDF generation for the library API reference.

Upgraded PCRE library.

Added markdown rules.

Upgraded MHD and uthash libraries.

2020-03-09 silvioprog <silvioprog@gmail.com>

Limited the shutdown time out based on the maximum connection time out of the clients.

2019-12-10 silvioprog <silvioprog@gmail.com>

Bump v2.5.2

Expand Down
8 changes: 8 additions & 0 deletions src/sg_httpres.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,11 @@ int sg_httpres_zsendstream2(struct sg_httpres *res, int level, uint64_t size,
goto error_res;
}
res->status = status;
#ifdef SG_TESTING
errnum = 0;
#else
return 0;
#endif
error_res:
sg_free(holder->buf_in);
error_buf_in:
Expand Down Expand Up @@ -563,7 +567,11 @@ int sg_httpres_zsendfile2(struct sg_httpres *res, int level, uint64_t size,
goto error_res;
}
res->status = status;
#ifdef SG_TESTING
errnum = 0;
#else
return 0;
#endif
error_res:
sg_free(holder->handle);
error_handle:
Expand Down
2 changes: 1 addition & 1 deletion src/sg_httpsrv.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* Cross-platform library which helps to develop web servers or frameworks.
*
* Copyright (C) 2016-2019 Silvio Clecio <silvioprog@gmail.com>
* Copyright (C) 2016-2020 Silvio Clecio <silvioprog@gmail.com>
*
* Sagui library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
10 changes: 5 additions & 5 deletions src/sg_routes.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ static struct sg_route *sg__route_new(const char *pattern, char *errmsg,
route->pattern = sg_malloc(off);
if (!route->pattern) {
*errnum = ENOMEM;
goto fail;
goto error;
}
snprintf(route->pattern, off, ((*pattern == '(') ? "%s" : "^%s$"), pattern);
route->re = pcre2_compile((PCRE2_SPTR) route->pattern, PCRE2_ZERO_TERMINATED,
Expand All @@ -70,28 +70,28 @@ static struct sg_route *sg__route_new(const char *pattern, char *errmsg,
_("Pattern compilation failed at offset %d: %s.\n"),
(unsigned int) off, err);
*errnum = EINVAL;
goto fail;
goto error;
}
#ifdef PCRE2_JIT_SUPPORT
*errnum = pcre2_jit_compile(route->re, PCRE2_JIT_COMPLETE);
if (*errnum < 0) {
pcre2_get_error_message(*errnum, err, sizeof(err));
snprintf(errmsg, errlen, _("JIT compilation failed: %s.\n"), err);
*errnum = EINVAL;
goto fail;
goto error;
}
#endif
route->match = pcre2_match_data_create_from_pattern(route->re, NULL);
if (!route->match) {
strncpy(errmsg, _("Cannot allocate match data from the pattern.\n"),
errlen);
*errnum = EINVAL;
goto fail;
goto error;
}
route->cb = cb;
route->cls = cls;
return route;
fail:
error:
sg__route_free(route);
return NULL;
}
Expand Down
8 changes: 4 additions & 4 deletions src/sg_strmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,16 @@ struct sg_strmap *sg__strmap_new(const char *name, const char *val) {
return NULL;
pair->key = strdup(name);
if (!pair->key)
goto fail;
goto error;
pair->name = strdup(name);
if (!pair->name)
goto fail;
goto error;
pair->val = strdup(val);
if (!pair->val)
goto fail;
goto error;
sg__toasciilower(pair->key);
return pair;
fail:
error:
sg__strmap_free(pair);
return NULL;
}
Expand Down
5 changes: 0 additions & 5 deletions test/test_httpres.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,6 @@ static void test_httpres_sendbinary(struct sg_httpres *res) {
MHD_destroy_response(res->handle);
res->handle = NULL;
res->status = 0;
ASSERT(sg_httpres_sendbinary(res, "", len, "text/plain", 200) == 0);
ASSERT(res->status == 200);
MHD_destroy_response(res->handle);
res->handle = NULL;
res->status = 0;
ASSERT(sg_httpres_sendbinary(res, "foo", 0, "text/plain", 200) == 0);
ASSERT(res->status == 200);
MHD_destroy_response(res->handle);
Expand Down
2 changes: 1 addition & 1 deletion test/test_httpsrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* Cross-platform library which helps to develop web servers or frameworks.
*
* Copyright (C) 2016-2019 Silvio Clecio <silvioprog@gmail.com>
* Copyright (C) 2016-2020 Silvio Clecio <silvioprog@gmail.com>
*
* Sagui library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
Expand Down
5 changes: 1 addition & 4 deletions test/test_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,11 +449,8 @@ static void test_ip(void) {
ASSERT(sg_ip(&sa, buf, -1) == EINVAL);

sa.sa_family = AF_INET;
ASSERT(sg_ip(&sa, buf, 16) == 0);
ASSERT(sg_ip(&sa, buf, sizeof(buf)) == 0);
ASSERT(strcmp(buf, "0.0.0.0") == 0);
sa.sa_family = AF_INET6;
ASSERT(sg_ip(&sa, buf, 46) == 0);
ASSERT(strlen(buf) > 0);

/* we do not need massive testing for inet_ntop() since it is already tested by the glibc team. */
}
Expand Down

0 comments on commit 898209f

Please sign in to comment.