FreeBSD Bugzilla – Attachment 216353 Details for
Bug 247884
New port: www/gwsocket Simple WebSocket Server
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
SVN diff
gwsocket.diff (text/plain), 13.72 KB, created by
Daniel Morante
on 2020-07-10 05:51:38 UTC
(
hide
)
Description:
SVN diff
Filename:
MIME Type:
Creator:
Daniel Morante
Created:
2020-07-10 05:51:38 UTC
Size:
13.72 KB
patch
obsolete
>Index: www/gwsocket/Makefile >=================================================================== >--- www/gwsocket/Makefile (nonexistent) >+++ www/gwsocket/Makefile (working copy) >@@ -0,0 +1,71 @@ >+# Created by: Daniel Morante <daniel@morante.net> >+# $FreeBSD$ >+ >+PORTNAME= gwsocket >+PORTVERSION= 0.3 >+CATEGORIES= www >+MASTER_SITES= http://tar.gwsocket.io/ >+ >+MAINTAINER= daniel@morante.net >+COMMENT= RFC6455 compliant WebSocket Server >+ >+LICENSE= MIT >+LICENSE_FILE= ${WRKSRC}/COPYING >+ >+GNU_CONFIGURE= yes >+INSTALL_TARGET= install-strip >+USES= alias compiler:c11 pkgconfig >+USE_LDCONFIG= yes >+ >+CFLAGS+= -I${NCURSESINC} -I${LOCALBASE}/include >+LDFLAGS+= -L${NCURSESLIB} -L${LOCALBASE}/lib >+ >+PORTDOCS= AUTHORS COPYING ChangeLog NEWS README >+ >+OPTIONS_DEFINE= DOCS DEBUG UTF8 OPENSSL EXAMPLES >+OPTIONS_DEFAULT= UTF8 >+OPTIONS_SUB= yes >+ >+DEBUG_CONFIGURE_ON= --enable-debug >+UTF8_CONFIGURE_ON= --enable-utf8 >+ >+OPENSSL_USES= ssl >+OPENSSL_CONFIGURE_ON= --with-openssl=${OPENSSLBASE} >+ >+USE_RC_SUBR= ${PORTNAME} >+ >+USERS= www >+GROUPS= www >+ >+DEFAULT_RUNDIR?= /var/run/${PORTNAME} >+DEFAULT_LOGDIR?= /var/log/${PORTNAME} >+ >+SUB_FILES= pkg-message >+SUB_LIST+= PORTNAME=${PORTNAME} \ >+ DEFAULT_USER=${USERS} \ >+ DEFAULT_GROUP=${GROUPS} \ >+ DEFAULT_RUNDIR=${DEFAULT_RUNDIR} \ >+ DEFAULT_LOGDIR=${DEFAULT_LOGDIR} >+ >+PLIST_SUB+= PORTNAME=${PORTNAME} \ >+ DEFAULT_USER=${USERS} \ >+ DEFAULT_GROUP=${GROUPS} \ >+ DEFAULT_RUNDIR=${DEFAULT_RUNDIR} \ >+ DEFAULT_LOGDIR=${DEFAULT_LOGDIR} >+ >+do-install-DOCS-on: >+ @${MKDIR} ${STAGEDIR}${DOCSDIR} >+ ${INSTALL_DATA} ${PORTDOCS:S,^,${WRKSRC}/,} ${STAGEDIR}${DOCSDIR} >+ >+post-install-EXAMPLES-on: >+ @${MKDIR} ${STAGEDIR}${EXAMPLESDIR} >+ ${INSTALL_DATA} ${FILESDIR}/sample.html ${STAGEDIR}${EXAMPLESDIR} >+ >+post-install: >+ @${MKDIR} ${STAGEDIR}${ETCDIR} \ >+ ${STAGEDIR}${DEFAULT_RUNDIR} \ >+ ${STAGEDIR}${DEFAULT_LOGDIR} >+ ${INSTALL_DATA} ${FILESDIR}/${PORTNAME}.conf \ >+ ${STAGEDIR}${ETCDIR}/${PORTNAME}.conf.sample >+ >+.include <bsd.port.mk> > >Property changes on: www/gwsocket/Makefile >___________________________________________________________________ >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:keywords >## -0,0 +1 ## >+FreeBSD=%H >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: www/gwsocket/distinfo >=================================================================== >--- www/gwsocket/distinfo (nonexistent) >+++ www/gwsocket/distinfo (working copy) >@@ -0,0 +1,3 @@ >+TIMESTAMP = 1594149039 >+SHA256 (gwsocket-0.3.tar.gz) = b2a46bbbc99faaf2dd99095d81bc29128fe54298ba6f4f9203ec3d2e4cc4c528 >+SIZE (gwsocket-0.3.tar.gz) = 146851 > >Property changes on: www/gwsocket/distinfo >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: www/gwsocket/files/gwsocket.conf >=================================================================== >--- www/gwsocket/files/gwsocket.conf (nonexistent) >+++ www/gwsocket/files/gwsocket.conf (working copy) >@@ -0,0 +1,42 @@ >+# This config file is evaluated by the rc script from the FreeBSD port of www/gwsocket. >+# It is not related to gwsocket(1) itself. >+# >+# Most options are set with "name=value" assignments. >+ >+# Specifies the port to bind. (-p --port) >+#port=7890 >+ >+# Specifies the path/file for the access log. (--access-log=<path/file>) >+#access-log=/var/log/gwsocket/gwsocket-access.log >+ >+# Specifies the address to bind. (--addr=<addr>) >+#addr=127.0.0.1 >+ >+# Set the server to echo all received messages. (--echo-mode) >+# Exclude, set to 'false' or 'no' to disable. Set to 'true' or 'yes' to enable >+#echo-mode=no >+ >+# Maximum size of a websocket frame. This includes received frames from the >+# client and messages through the named pipe. (--max-frame-size=<bytes>) >+#max-frame-size= >+ >+# Ensure clients send the specified origin header upon the WebSocket >+# handshake. (--origin=<origin>) >+#origin= >+ >+# Creates a named pipe (FIFO) that reads from on the given path/file. (--pipein=<path/file>) >+#pipein= >+ >+# Creates a named pipe (FIFO) that writes to the given path/file. (--pipeout=<path/file>) >+#pipeout= >+ >+# Parse messages using strict mode. See man page for more details. (--strict) >+# Exclude, set to 'false' or 'no' to disable. Set to 'true' or 'yes' to enable >+#strict=no >+ >+# Path to TLS/SSL certificate. (--ssl-cert=<cert.crt>) >+#ssl-cert= >+ >+# Path to TLS/SSL private key. (--ssl-key=<priv.key>) >+#ssl-key= >+ > >Property changes on: www/gwsocket/files/gwsocket.conf >___________________________________________________________________ >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: www/gwsocket/files/gwsocket.in >=================================================================== >--- www/gwsocket/files/gwsocket.in (nonexistent) >+++ www/gwsocket/files/gwsocket.in (working copy) >@@ -0,0 +1,138 @@ >+#!/bin/sh >+ >+# $FreeBSD:$ >+# >+# PROVIDE: %%PORTNAME%% >+# REQUIRE: LOGIN >+# KEYWORD: shutdown >+ >+# Add the following lines to /etc/rc.conf to enable %%PORTNAME%% >+# %%PORTNAME%%_enable="YES" >+# >+# Add the following lines to /etc/rc.conf to enable multiple instances of %%PORTNAME%% >+# %%PORTNAME%%_multi_enable="YES" >+# An instance is created for each *.conf file found in the configration files directory >+# >+# %%PORTNAME%%_enable (bool): Set to YES to enable %%PORTNAME%% >+# Default: NO >+# %%PORTNAME%%_multi_enable (bool): Set to YES to run multiple instances (%%PORTNAME%%_config is ignored) >+# Default: NO >+# %%PORTNAME%%_conf_d (str): %%PORTNAME%% configration files directory >+# Default: %%ETCDIR%% >+# %%PORTNAME%%_config (str): %%PORTNAME%% configration file (ignored when %%PORTNAME%%_multi_enable="YES") >+# Default: %%ETCDIR%%/%%PORTNAME%%.conf >+# %%PORTNAME%%_user (str): %%PORTNAME%% daemon user >+# Default: %%DEFAULT_USER%% >+# %%PORTNAME%%_group (str): %%PORTNAME%% daemon group >+# Default: %%DEFAULT_GROUP%% >+# %%PORTNAME%%_logdir (str): %%PORTNAME%% log directory >+# Default: %%DEFAULT_LOGDIR%% >+# %%PORTNAME%%_piddir (str): %%PORTNAME%% pid file directory >+# Default: %%DEFAULT_RUNDIR%% >+ >+. /etc/rc.subr >+ >+name="%%PORTNAME%%" >+rcvar=%%PORTNAME%%_enable >+load_rc_config $name >+ >+: ${%%PORTNAME%%_enable:="NO"} >+: ${%%PORTNAME%%_multi_enable:="NO"} >+: ${%%PORTNAME%%_user:="%%DEFAULT_USER%%"} >+: ${%%PORTNAME%%_group:="%%DEFAULT_GROUP%%"} >+: ${%%PORTNAME%%_conf_d:="%%ETCDIR%%"} >+: ${%%PORTNAME%%_config:="${%%PORTNAME%%_conf_d%/}/${name}.conf"} >+: ${%%PORTNAME%%_logdir:="%%DEFAULT_LOGDIR%%"} >+: ${%%PORTNAME%%_piddir:="%%DEFAULT_RUNDIR%%"} >+ >+required_dirs="${%%PORTNAME%%_logdir} ${%%PORTNAME%%_piddir}" >+required_files=${%%PORTNAME%%_config} >+procname="%%PREFIX%%/bin/${name}" >+procdesc="${name}" >+pidfile="${%%PORTNAME%%_piddir%/}/${name}.pid" >+logfile="${%%PORTNAME%%_logdir%/}/${name}.log" >+command=/usr/sbin/daemon >+start_precmd="%%PORTNAME%%_precmd" >+ >+%%PORTNAME%%_precmd() >+{ >+ # Loads the options declared in the configuration file into "$command_args". >+ %%PORTNAME%%_conf_to_args ${%%PORTNAME%%_config} >+} >+ >+%%PORTNAME%%_conf_to_args() >+{ >+ local _line %%PORTNAME%%_config_param %%PORTNAME%%_config_value config_file_path=$1 >+ command_args="-f -t ${procdesc} -p ${pidfile} -o ${logfile} ${procname}" >+ >+ while read -r _line; do >+ # Only proceed with lines which contain variable declaration. >+ echo "${_line}" | grep -q -E \ >+ -e "^[[:blank:]]*[[:alpha:]_-][[:alnum:]_-]{0,30}=" || >+ continue >+ >+ %%PORTNAME%%_config_param=${_line%%=*} >+ %%PORTNAME%%_config_value=${_line#*=} >+ >+ # Properly handle flag type paramaters >+ if %%PORTNAME%%_is_flag_param ${%%PORTNAME%%_config_param}; then >+ if checkyesno %%PORTNAME%%_config_value; then >+ command_args="$command_args --${%%PORTNAME%%_config_param}" >+ fi >+ elif [ -n "${%%PORTNAME%%_config_value}" ]; then >+ command_args="$command_args --${%%PORTNAME%%_config_param}=${%%PORTNAME%%_config_value}" >+ fi >+ done < ${config_file_path} >+} >+ >+%%PORTNAME%%_find_instances() >+{ >+ local instance_config >+ for instance_config in ${%%PORTNAME%%_conf_d%/}/*.conf; do >+ [ -f "$instance_config" ] || break >+ %%PORTNAME%%_instances="$%%PORTNAME%%_instances $(basename ${instance_config%.conf})"; >+ done >+} >+ >+%%PORTNAME%%_is_flag_param() >+{ >+ case $1 in >+ 'echo-mode' | 'strict' ) >+ return 0 >+ ;; >+ *) >+ return 1 >+ ;; >+ esac >+} >+ >+# Handles multi-instance feature >+if [ $# -eq 2 ]; then >+ # Performs action on single instance by name >+ _instance=$2 >+ echo "===> Instance: ${_instance}" >+ >+ # Setup for the requested instance name >+ %%PORTNAME%%_config="${%%PORTNAME%%_conf_d%/}/${_instance}.conf" >+ procdesc="${name}_${_instance}" >+ pidfile="${%%PORTNAME%%_piddir%/}/${_instance}.pid" >+ logfile="${%%PORTNAME%%_logdir%/}/${_instance}.log" >+ >+ # The config file for the named instance must exist >+ required_files="${%%PORTNAME%%_config}" >+elif checkyesno %%PORTNAME%%_multi_enable; then >+ # Compile list of all instances or given instances >+ _swap=$*; shift; _instances=$* >+ %%PORTNAME%%_find_instances >+ _instances=${_instances:-${%%PORTNAME%%_instances}} >+ set -- ${_swap} >+ >+ # Performs action on each instance >+ for _instance in ${_instances}; do >+ %%PREFIX%%/etc/rc.d/${name} $1 ${_instance} >+ done >+ exit 0 >+fi >+ >+run_rc_command "$1" >+ > >Property changes on: www/gwsocket/files/gwsocket.in >___________________________________________________________________ >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: www/gwsocket/files/pkg-message.in >=================================================================== >--- www/gwsocket/files/pkg-message.in (nonexistent) >+++ www/gwsocket/files/pkg-message.in (working copy) >@@ -0,0 +1,26 @@ >+[ >+{ type: install >+ message: <<EOM >+ >+To run %%PORTNAME%% at startup, enable it in your /etc/rc.conf: >+sysrc %%PORTNAME%%_enable="YES" >+ >+To start %%PORTNAME%%: >+service %%PORTNAME%% start >+ >+To configure %%PORTNAME%% edit: >+%%ETCDIR%%/%%PORTNAME%%.conf >+ >+A client example can be found at %%EXAMPLESDIR%%/sample.html >+ >+To run multiple instances of %%PORTNAME%%, enable it in your /etc/rc.conf: >+sysrc %%PORTNAME%%_multi_enable="YES" >+ >+An instance will be created for each *.conf file found in: >+%%ETCDIR%% >+ >+EOM >+} >+] >+ >+ > >Property changes on: www/gwsocket/files/pkg-message.in >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: www/gwsocket/files/sample.html >=================================================================== >--- www/gwsocket/files/sample.html (nonexistent) >+++ www/gwsocket/files/sample.html (working copy) >@@ -0,0 +1,43 @@ >+<!DOCTYPE html> >+<html lang="en"> >+<style> >+pre { >+ background: #EEE; >+ border: 1px solid #CCC; >+ padding: 10px; >+} >+#page-wrapper { >+ border-top: 5px solid #69c773; >+ margin: 1em auto; >+ width: 950px; >+} >+</style> >+<script> >+window.onload = function() { >+ function $(selector) { >+ return document.querySelector(selector); >+ } >+ var socket = new WebSocket('ws://localhost:7890'); >+ socket.onopen = function(event) { >+ $('#messages').innerHTML = 'Connected<br>'; >+ }; >+ socket.onmessage = function(event) { >+ $('#messages').innerHTML += 'Received:<br>' + event.data + '<br>'; >+ }; >+ socket.onclose = function(event) { >+ $('#messages').innerHTML = 'Disconnected ' + event.reason; >+ }; >+ $('#submit').onclick = function(e) { >+ socket.send($('input').value); >+ $('#messages').innerHTML += 'Sent:<br>' + $('input').value + '<br>'; >+ $('input').value = ''; >+ }; >+}; >+</script> >+ >+<div id="page-wrapper"> >+ <pre id="messages">Connecting...</pre> >+ <input id="message" required> >+ <button id="submit">Send Message</button> >+</div> >+ > >Property changes on: www/gwsocket/files/sample.html >___________________________________________________________________ >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: www/gwsocket/pkg-descr >=================================================================== >--- www/gwsocket/pkg-descr (nonexistent) >+++ www/gwsocket/pkg-descr (working copy) >@@ -0,0 +1,4 @@ >+gwsocket is a simple, standalone, language-agnostic, RFC6455 compliant >+WebSocket Server, written in C. >+ >+WWW: https://gwsocket.io > >Property changes on: www/gwsocket/pkg-descr >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: www/gwsocket/pkg-plist >=================================================================== >--- www/gwsocket/pkg-plist (nonexistent) >+++ www/gwsocket/pkg-plist (working copy) >@@ -0,0 +1,6 @@ >+bin/%%PORTNAME%% >+man/man1/%%PORTNAME%%.1.gz >+%%PORTEXAMPLES%%%%EXAMPLESDIR%%/sample.html >+@sample %%ETCDIR%%/%%PORTNAME%%.conf.sample >+@dir(%%DEFAULT_USER%%,%%DEFAULT_GROUP%%,) %%DEFAULT_LOGDIR%% >+@dir(%%DEFAULT_USER%%,%%DEFAULT_GROUP%%,) %%DEFAULT_RUNDIR%% > >Property changes on: www/gwsocket/pkg-plist >___________________________________________________________________ >Added: fbsd:nokeywords >## -0,0 +1 ## >+yes >\ No newline at end of property >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 247884
:
216353
|
216357
|
216372
|
216373