{"schema":"libjg2-1",
"vpath":"/git/",
"avatar":"/git/avatar/",
"alang":"",
"gen_ut":1746421085,
"reponame":"libwebsockets",
"desc":"libwebsockets lightweight C networking library",
"owner": { "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },"url":"https://libwebsockets.org/repo/libwebsockets",
"f":3,
"items": [
{"schema":"libjg2-1",
"cid":"4ac8986ae6ab35cbe1f527b5bed40e88",
"commit": {"type":"commit",
"time": 1295365142,
"time_ofs": 0,
"oid_tree": { "oid": "d07b4c2e5d16f98cf15487fc8dd24634716aca02", "alias": []},
"oid":{ "oid": "df73616d2c4656565bb77c7b6bc3907bfdf0da53", "alias": []},
"msg": "add-base64-encode-decode.patch",
"sig_commit": { "git_time": { "time": 1295365142, "offset": 0 }, "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },
"sig_author": { "git_time": { "time": 1295365142, "offset": 0 }, "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" }},
"body": "add-base64-encode-decode.patch\n\nSigned-off-by: Andy Green \u003candy@warmcat.com\u003e\n"
,
"diff": "diff --git a/lib/Makefile.am b/lib/Makefile.am\nindex 87b251d..4db463b 100644\n--- a/lib/Makefile.am\n+++ b/lib/Makefile.am\n@@ -4,6 +4,7 @@ dist_libwebsockets_la_SOURCES\u003dlibwebsockets.c \u005c\n \t\t\t\thandshake.c \u005c\n \t\t\t\tparsers.c \u005c\n \t\t\t\tlibwebsockets.h \u005c\n+\t\t\t\tbase64-decode.c \u005c\n \t\t\t\tprivate-libwebsockets.h\n libwebsockets_la_CFLAGS\u003d-Wall -Werror -std\u003dgnu99 -pedantic -rdynamic -fPIC -c\n libwebsockets_la_LDFLAGS\u003d-version-info 0:2 -lcrypto\ndiff --git a/lib/Makefile.in b/lib/Makefile.in\nindex 73cf59c..304866c 100644\n--- a/lib/Makefile.in\n+++ b/lib/Makefile.in\n@@ -71,7 +71,8 @@ am__installdirs \u003d \u0022$(DESTDIR)$(libdir)\u0022 \u0022$(DESTDIR)$(includedir)\u0022\n LTLIBRARIES \u003d $(lib_LTLIBRARIES)\n libwebsockets_la_LIBADD \u003d\n dist_libwebsockets_la_OBJECTS \u003d libwebsockets_la-libwebsockets.lo \u005c\n-\tlibwebsockets_la-handshake.lo libwebsockets_la-parsers.lo\n+\tlibwebsockets_la-handshake.lo libwebsockets_la-parsers.lo \u005c\n+\tlibwebsockets_la-base64-decode.lo\n libwebsockets_la_OBJECTS \u003d $(dist_libwebsockets_la_OBJECTS)\n libwebsockets_la_LINK \u003d $(LIBTOOL) --tag\u003dCC $(AM_LIBTOOLFLAGS) \u005c\n \t$(LIBTOOLFLAGS) --mode\u003dlink $(CCLD) $(libwebsockets_la_CFLAGS) \u005c\n@@ -214,6 +215,7 @@ dist_libwebsockets_la_SOURCES \u003d libwebsockets.c \u005c\n \t\t\t\thandshake.c \u005c\n \t\t\t\tparsers.c \u005c\n \t\t\t\tlibwebsockets.h \u005c\n+\t\t\t\tbase64-decode.c \u005c\n \t\t\t\tprivate-libwebsockets.h\n \n libwebsockets_la_CFLAGS \u003d -Wall -Werror -std\u003dgnu99 -pedantic -rdynamic -fPIC -c\n@@ -292,6 +294,7 @@ mostlyclean-compile:\n distclean-compile:\n \t-rm -f *.tab.c\n \n+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwebsockets_la-base64-decode.Plo@am__quote@\n @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwebsockets_la-handshake.Plo@am__quote@\n @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwebsockets_la-libwebsockets.Plo@am__quote@\n @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libwebsockets_la-parsers.Plo@am__quote@\n@@ -338,6 +341,13 @@ libwebsockets_la-parsers.lo: parsers.c\n @AMDEP_TRUE@@am__fastdepCC_FALSE@\tDEPDIR\u003d$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n @am__fastdepCC_FALSE@\t$(LIBTOOL) --tag\u003dCC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode\u003dcompile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_la_CFLAGS) $(CFLAGS) -c -o libwebsockets_la-parsers.lo `test -f 'parsers.c' || echo '$(srcdir)/'`parsers.c\n \n+libwebsockets_la-base64-decode.lo: base64-decode.c\n+@am__fastdepCC_TRUE@\t$(LIBTOOL) --tag\u003dCC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode\u003dcompile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_la_CFLAGS) $(CFLAGS) -MT libwebsockets_la-base64-decode.lo -MD -MP -MF $(DEPDIR)/libwebsockets_la-base64-decode.Tpo -c -o libwebsockets_la-base64-decode.lo `test -f 'base64-decode.c' || echo '$(srcdir)/'`base64-decode.c\n+@am__fastdepCC_TRUE@\t$(am__mv) $(DEPDIR)/libwebsockets_la-base64-decode.Tpo $(DEPDIR)/libwebsockets_la-base64-decode.Plo\n+@AMDEP_TRUE@@am__fastdepCC_FALSE@\tsource\u003d'base64-decode.c' object\u003d'libwebsockets_la-base64-decode.lo' libtool\u003dyes @AMDEPBACKSLASH@\n+@AMDEP_TRUE@@am__fastdepCC_FALSE@\tDEPDIR\u003d$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@\n+@am__fastdepCC_FALSE@\t$(LIBTOOL) --tag\u003dCC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode\u003dcompile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libwebsockets_la_CFLAGS) $(CFLAGS) -c -o libwebsockets_la-base64-decode.lo `test -f 'base64-decode.c' || echo '$(srcdir)/'`base64-decode.c\n+\n mostlyclean-libtool:\n \t-rm -f *.lo\n \ndiff --git a/lib/base64-decode.c b/lib/base64-decode.c\nnew file mode 100644\nindex 0000000..d38ba45\n--- /dev/null\n+++ b/lib/base64-decode.c\n@@ -0,0 +1,196 @@\n+/*\n+ * This code originally came from here\n+ *\n+ * http://base64.sourceforge.net/b64.c\n+ *\n+ * with the following license:\n+ *\n+ * LICENCE: Copyright (c) 2001 Bob Trower, Trantor Standard Systems Inc.\n+ *\n+ * Permission is hereby granted, free of charge, to any person\n+ * obtaining a copy of this software and associated\n+ * documentation files (the \u0022Software\u0022), to deal in the\n+ * Software without restriction, including without limitation\n+ * the rights to use, copy, modify, merge, publish, distribute,\n+ * sublicense, and/or sell copies of the Software, and to\n+ * permit persons to whom the Software is furnished to do so,\n+ * subject to the following conditions:\n+ *\n+ * The above copyright notice and this permission notice shall\n+ * be included in all copies or substantial portions of the\n+ * Software.\n+ *\n+ * THE SOFTWARE IS PROVIDED \u0022AS IS\u0022, WITHOUT WARRANTY OF ANY\n+ * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE\n+ * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR\n+ * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS\n+ * OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR\n+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n+ *\n+ * VERSION HISTORY:\n+ * Bob Trower 08/04/01 -- Create Version 0.00.00B\n+ *\n+ * I cleaned it up quite a bit to match the (linux kernel) style of the rest\n+ * of libwebsockets; this version is under LGPL2 like the rest of libwebsockets\n+ * since he explictly allows sublicensing, but I give the URL above so you can\n+ * get the original with Bob's super-liberal terms directly if you prefer.\n+ */\n+\n+\n+#include \u003cstdio.h\u003e\n+#include \u003cstring.h\u003e\n+\n+static const char encode[] \u003d \u0022ABCDEFGHIJKLMNOPQRSTUVWXYZ\u0022\n+\t\t\t \u0022abcdefghijklmnopqrstuvwxyz0123456789+/\u0022;\n+static const char decode[] \u003d \u0022|$$$}rstuvwxyz{$$$$$$$\u003e?@ABCDEFGHIJKLMNOPQRSTUVW\u0022\n+\t\t\t \u0022$$$$$$XYZ[\u005c\u005c]^_`abcdefghijklmnopq\u0022;\n+\n+int\n+lws_b64_encode_string(const char *in, char *out, int out_size)\n+{\n+\tunsigned char triple[3];\n+\tint i;\n+\tint len;\n+\tint line \u003d 0;\n+\tint done \u003d 0;\n+\n+\twhile (*in) {\n+\t\tlen \u003d 0;\n+\t\tfor (i \u003d 0; i \u003c 3; i++) {\n+\t\t\tif (*in) {\n+\t\t\t\ttriple[i] \u003d *in++;\n+\t\t\t\tlen++;\n+\t\t\t} else\n+\t\t\t\ttriple[i] \u003d 0;\n+\t\t}\n+\t\tif (len) {\n+\n+\t\t\tif (done + 4 \u003e\u003d out_size)\n+\t\t\t\treturn -1;\n+\n+\t\t\t*out++ \u003d encode[triple[0] \u003e\u003e 2];\n+\t\t\t*out++ \u003d encode[((triple[0] \u0026 0x03) \u003c\u003c 4) |\n+\t\t\t\t\t\t ((triple[1] \u0026 0xf0) \u003e\u003e 4)];\n+\t\t\t*out++ \u003d (len \u003e 1 ? encode[((triple[1] \u0026 0x0f) \u003c\u003c 2) |\n+\t\t\t\t\t ((triple[2] \u0026 0xc0) \u003e\u003e 6)] : '\u003d');\n+\t\t\t*out++ \u003d (len \u003e 2 ? encode[triple[2] \u0026 0x3f] : '\u003d');\n+\n+\t\t\tdone +\u003d 4;\n+\t\t\tline +\u003d 4;\n+\t\t}\n+\t\tif (line \u003e\u003d 72) {\n+\n+\t\t\tif (done + 2 \u003e\u003d out_size)\n+\t\t\t\treturn -1;\n+\n+\t\t\t*out++ \u003d '\u005cr';\n+\t\t\t*out++ \u003d '\u005cn';\n+\t\t\tdone +\u003d 2;\n+\t\t\tline \u003d 0;\n+\t\t}\n+\t}\n+\n+\tif (done + 1 \u003e\u003d out_size)\n+\t\treturn -1;\n+\n+\t*out++ \u003d '\u005c0';\n+\n+\treturn done;\n+}\n+\n+/*\n+ * returns length of decoded string in out, or -1 if out was too small\n+ * according to out_size\n+ */\n+\n+int\n+lws_b64_decode_string(const char *in, char *out, int out_size)\n+{\n+\tint len;\n+\tint i;\n+\tint done \u003d 0;\n+\tunsigned char v;\n+\tunsigned char quad[4];\n+\n+\twhile (*in) {\n+\n+\t\tlen \u003d 0;\n+\t\tfor (i \u003d 0; i \u003c 4 \u0026\u0026 *in; i++) {\n+\n+\t\t\tv \u003d 0;\n+\t\t\twhile (*in \u0026\u0026 !v) {\n+\n+\t\t\t\tv \u003d *in++;\n+\t\t\t\tv \u003d (v \u003c 43 || v \u003e 122) ? 0 : decode[v - 43];\n+\t\t\t\tif (v)\n+\t\t\t\t\tv \u003d (v \u003d\u003d '$') ? 0 : v - 61;\n+\t\t\t\tif (*in) {\n+\t\t\t\t\tlen++;\n+\t\t\t\t\tif (v)\n+\t\t\t\t\t\tquad[i] \u003d v - 1;\n+\t\t\t\t} else\n+\t\t\t\t\tquad[i] \u003d 0;\n+\t\t\t}\n+\t\t}\n+\t\tif (!len)\n+\t\t\tcontinue;\n+\n+\t\tif (out_size \u003c (done + len - 1))\n+\t\t\t/* out buffer is too small */\n+\t\t\treturn -1;\n+\n+\t\tif (len \u003e\u003d 2)\n+\t\t\t*out++ \u003d quad[0] \u003c\u003c 2 | quad[1] \u003e\u003e 4;\n+\t\tif (len \u003e\u003d 3)\n+\t\t\t*out++ \u003d quad[1] \u003c\u003c 4 | quad[2] \u003e\u003e 2;\n+\t\tif (len \u003e\u003d 4)\n+\t\t\t*out++ \u003d ((quad[2] \u003c\u003c 6) \u0026 0xc0) | quad[3];\n+\n+\t\tdone +\u003d len - 1;\n+\t}\n+\n+\tif (done + 1 \u003e\u003d out_size)\n+\t\treturn -1;\n+\n+\t*out++ \u003d '\u005c0';\n+\n+\treturn done;\n+}\n+\n+int\n+lws_b64_selftest(void)\n+{\n+\tchar buf[64];\n+\tint n;\n+\tint test;\n+\tstatic const char *plaintext[] \u003d {\n+\t\t\u0022sanity check base 64\u0022\n+\t};\n+\tstatic const char *coded[] \u003d {\n+\t\t\u0022c2FuaXR5IGNoZWNrIGJhc2UgNjQ\u003d\u0022\n+\t};\n+\n+\tfor (test \u003d 0; test \u003c sizeof plaintext / sizeof(plaintext[0]); test++) {\n+\n+\t\tbuf[sizeof(buf) - 1] \u003d '\u005c0';\n+\t\tn \u003d lws_b64_encode_string(plaintext[test], buf, sizeof buf);\n+\t\tif (n !\u003d strlen(coded[test]) || strcmp(buf, coded[test])) {\n+\t\t\tfprintf(stderr, \u0022Failed lws_b64 encode selftest \u0022\n+\t\t\t\t\t \u0022%d result '%s' %d\u005cn\u0022, test, buf, n);\n+\t\t\treturn -1;\n+\t\t}\n+\n+\t\tbuf[sizeof(buf) - 1] \u003d '\u005c0';\n+\t\tn \u003d lws_b64_decode_string(coded[test], buf, sizeof buf);\n+\t\tif (n !\u003d strlen(plaintext[test]) ||\n+\t\t\t\t\t\t strcmp(buf, plaintext[test])) {\n+\t\t\tfprintf(stderr, \u0022Failed lws_b64 decode selftest \u0022\n+\t\t\t\t\t \u0022%d result '%s' %d\u005cn\u0022, test, buf, n);\n+\t\t\treturn -1;\n+\t\t}\n+\t}\n+\n+\treturn 0;\n+}\ndiff --git a/lib/libwebsockets.c b/lib/libwebsockets.c\nindex 1cd2974..6917d1e 100644\n--- a/lib/libwebsockets.c\n+++ b/lib/libwebsockets.c\n@@ -320,6 +320,12 @@ int libwebsocket_create_server(int port,\n \t}\n #endif\n \n+\t/* selftest */\n+\n+\tif (lws_b64_selftest())\n+\t\treturn -1;\n+\n+\n \tthis \u003d malloc(sizeof(struct libwebsocket_context));\n \n \t/* set up our external listening socket we serve on */\ndiff --git a/lib/private-libwebsockets.h b/lib/private-libwebsockets.h\nindex c7becf0..27694c0 100644\n--- a/lib/private-libwebsockets.h\n+++ b/lib/private-libwebsockets.h\n@@ -173,3 +173,12 @@ libwebsocket_interpret_incoming_packet(struct libwebsocket *wsi,\n \n extern int\n libwebsocket_read(struct libwebsocket *wsi, unsigned char * buf, size_t len);\n+\n+extern int\n+lws_b64_encode_string(const char *in, char *out, int out_size);\n+\n+extern int\n+lws_b64_decode_string(const char *in, char *out, int out_size);\n+\n+extern int\n+lws_b64_selftest(void);\ndiff --git a/libwebsockets.spec b/libwebsockets.spec\nindex 44af184..76e8e3d 100644\n--- a/libwebsockets.spec\n+++ b/libwebsockets.spec\n@@ -1,6 +1,6 @@\n Name: libwebsockets\n Version: 0.1\n-Release: 35.gmaster_8322b370%{?dist}\n+Release: 41.gmaster_91ef816b%{?dist}\n Summary: Websocket Server Library\n \n Group: System\n","s":{"c":1746421085,"u": 3020}}
],"g": 4983,"chitpc": 0,"ehitpc": 0,"indexed":0
,
"ab": 0, "si": 0, "db":0, "di":0, "sat":0, "lfc": "0000"}