CLEANUP: assorted typo fixes in the code and comments

This is 8th iteration of typo fixes
diff --git a/include/proto/fd.h b/include/proto/fd.h
index 9783f90..8848437 100644
--- a/include/proto/fd.h
+++ b/include/proto/fd.h
@@ -310,7 +310,7 @@
 }
 
 /* Set the fd as currently running on the current thread.
- * Retuns 0 if all goes well, or -1 if we no longer own the fd, and should
+ * Returns 0 if all goes well, or -1 if we no longer own the fd, and should
  * do nothing with it.
  */
 static inline int fd_set_running(int fd)
diff --git a/include/types/connection.h b/include/types/connection.h
index 98f7638..8780590 100644
--- a/include/types/connection.h
+++ b/include/types/connection.h
@@ -253,7 +253,7 @@
 	CO_ER_SSL_TIMEOUT,      /* timeout during SSL handshake */
 	CO_ER_SSL_TOO_MANY,     /* too many SSL connections */
 	CO_ER_SSL_NO_MEM,       /* no more memory to allocate an SSL connection */
-	CO_ER_SSL_RENEG,        /* forbidden client renegociation */
+	CO_ER_SSL_RENEG,        /* forbidden client renegotiation */
 	CO_ER_SSL_CA_FAIL,      /* client cert verification failed in the CA chain */
 	CO_ER_SSL_CRT_FAIL,     /* client cert verification failed on the certificate */
 	CO_ER_SSL_MISMATCH,     /* Server presented an SSL certificate different from the configured one */
@@ -345,7 +345,7 @@
 /* mux_ops describes the mux operations, which are to be performed at the
  * connection level after data are exchanged with the transport layer in order
  * to propagate them to streams. The <init> function will automatically be
- * called once the mux is instanciated by the connection's owner at the end
+ * called once the mux is instantiated by the connection's owner at the end
  * of a transport handshake, when it is about to transfer data and the data
  * layer is not ready yet.
  */
@@ -370,7 +370,7 @@
 	void (*destroy)(void *ctx); /* Let the mux know one of its users left, so it may have to disappear */
 	void (*reset)(struct connection *conn); /* Reset the mux, because we're re-trying to connect */
 	const struct cs_info *(*get_cs_info)(struct conn_stream *cs); /* Return info on the specified conn_stream or NULL if not defined */
-	int (*ctl)(struct connection *conn, enum mux_ctl_type mux_ctl, void *arg); /* Provides informations about the mux */
+	int (*ctl)(struct connection *conn, enum mux_ctl_type mux_ctl, void *arg); /* Provides information about the mux */
 	int (*takeover)(struct connection *conn); /* Attempts to migrate the connection to the current thread */
 	unsigned int flags;                           /* some flags characterizing the mux's capabilities (MX_FL_*) */
 	char name[8];                                 /* mux layer name, zero-terminated */
@@ -426,14 +426,14 @@
 
 /*
  * This structure describes the info related to a conn_stream known by the mux
- * only but usefull for the upper layer.
+ * only but useful for the upper layer.
  * For now, only some dates and durations are reported. This structure will
  * envolved. But for now, only the bare minimum is referenced.
  */
 struct cs_info {
 	struct timeval create_date;  /* Creation date of the conn_stream in user date */
 	struct timeval tv_create;    /* Creation date of the conn_stream in internal date (monotonic) */
-	long t_handshake;            /* hanshake duration, -1 if never occurs */
+	long t_handshake;            /* handshake duration, -1 if never occurs */
 	long t_idle;                 /* idle duration, -1 if never occurs */
 };
 
@@ -452,7 +452,7 @@
 	unsigned int flags;           /* CO_FL_* */
 	const struct protocol *ctrl;  /* operations at the socket layer */
 	const struct xprt_ops *xprt;  /* operations at the transport layer */
-	const struct mux_ops  *mux;   /* mux layer opreations. Must be set before xprt->init() */
+	const struct mux_ops  *mux;   /* mux layer operations. Must be set before xprt->init() */
 	void *xprt_ctx;               /* general purpose pointer, initialized to NULL */
 	void *ctx;                    /* highest level context (usually the mux), initialized to NULL */
 	void *owner;                  /* pointer to the owner session, or NULL */
diff --git a/include/types/fd.h b/include/types/fd.h
index b4535af..178dea1 100644
--- a/include/types/fd.h
+++ b/include/types/fd.h
@@ -118,7 +118,7 @@
 
 /* info about one given fd */
 struct fdtab {
-	unsigned long running_mask;          /* mask of thread IDs currntly using the fd */
+	unsigned long running_mask;          /* mask of thread IDs currently using the fd */
 	unsigned long thread_mask;           /* mask of thread IDs authorized to process the fd */
 	unsigned long update_mask;           /* mask of thread IDs having an update for fd */
 	struct fdlist_entry update;          /* Entry in the global update list */
diff --git a/include/types/listener.h b/include/types/listener.h
index d4bc303..4b71ddb 100644
--- a/include/types/listener.h
+++ b/include/types/listener.h
@@ -190,7 +190,7 @@
 struct listener {
 	enum obj_type obj_type;         /* object type = OBJ_TYPE_LISTENER */
 	enum li_state state;            /* state: NEW, INIT, ASSIGNED, LISTEN, READY, FULL */
-	short int nice;                 /* nice value to assign to the instanciated tasks */
+	short int nice;                 /* nice value to assign to the instantiated tasks */
 	int fd;				/* the listen socket */
 	int luid;			/* listener universally unique ID, used for SNMP */
 	int options;			/* socket options : LI_O_* */
diff --git a/include/types/ssl_sock.h b/include/types/ssl_sock.h
index 7c21ae4..dbfa3d7 100644
--- a/include/types/ssl_sock.h
+++ b/include/types/ssl_sock.h
@@ -99,7 +99,7 @@
 	SETCERT_ST_FIN,
 };
 
-/* This is used to preload the certifcate, private key
+/* This is used to preload the certificate, private key
  * and Cert Chain of a file passed in via the crt
  * argument
  *
diff --git a/include/types/stream.h b/include/types/stream.h
index 39a6855..0dcc541 100644
--- a/include/types/stream.h
+++ b/include/types/stream.h
@@ -105,7 +105,7 @@
 	int level;                      /* log level to force + 1 if > 0, -1 = no log */
 	struct timeval accept_date;     /* date of the stream's accept() in user date */
 	struct timeval tv_accept;       /* date of the stream's accept() in internal date (monotonic) */
-	long t_handshake;               /* hanshake duration, -1 if never occurs */
+	long t_handshake;               /* handshake duration, -1 if never occurs */
 	long t_idle;                    /* idle duration, -1 if never occurs */
 	struct timeval tv_request;      /* date the request arrives, {0,0} if never occurs */
 	long  t_queue;                  /* delay before the stream gets out of the connect queue, -1 if never occurs */
diff --git a/scripts/backport b/scripts/backport
index 0dc102c..4f60140 100755
--- a/scripts/backport
+++ b/scripts/backport
@@ -88,7 +88,7 @@
 
 # backports commit "$1" with a signed-off by tag. In case of failure, aborts
 # the change and returns non-zero. Unneeded cherry-picks do return an error
-# because we don't want to accidently backport the latest commit instead of
+# because we don't want to accidentally backport the latest commit instead of
 # this one, and we don't know this one's ID.
 backport_commit() {
 	local empty=1
diff --git a/scripts/run-regtests.sh b/scripts/run-regtests.sh
index 7efc430..af25a60 100755
--- a/scripts/run-regtests.sh
+++ b/scripts/run-regtests.sh
@@ -19,7 +19,7 @@
     --v, to run verbose
       run-regtests.sh --v, disables the default vtest 'quiet' parameter
 
-    --debug to show test logs on standard ouput (implies --v)
+    --debug to show test logs on standard output (implies --v)
       run-regtests.sh --debug
 
     --keep-logs to keep all log directories (by default kept if test fails)
diff --git a/src/hlua.c b/src/hlua.c
index 98fa354..67aa2c6 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -111,7 +111,7 @@
  * code and recompile the library. This system will probably not accepted
  * by maintainers of various distribs.
  *
- * Our main excution point of the Lua is the function lua_resume(). A
+ * Our main execution point of the Lua is the function lua_resume(). A
  * quick looking on the Lua sources displays a lua_lock() a the start
  * of function and a lua_unlock() at the end of the function. So I
  * conclude that the Lua thread safe mode just perform a mutex around
@@ -653,7 +653,7 @@
 			return 0;
 		}
 
-		/* Check for exceed the number of requiered argument. */
+		/* Check for exceed the number of required argument. */
 		if ((mask & ARGT_MASK) == ARGT_STOP &&
 		    argp[idx].type != ARGT_STOP) {
 			WILL_LJMP(luaL_argerror(L, first + idx, "Last argument expected"));
@@ -883,18 +883,18 @@
  * throws an error (longjmp).
  *
  * In some case (at least one), this function can be called from safe
- * environement, so we must not initialise it. While the support of
+ * environment, so we must not initialise it. While the support of
  * threads appear, the safe environment set a lock to ensure only one
  * Lua execution at a time. If we initialize safe environment in another
- * safe environmenet, we have a dead lock.
+ * safe environment, we have a dead lock.
  *
  * set "already_safe" true if the context is initialized form safe
- * Lua fonction.
+ * Lua function.
  *
  * This function manipulates two Lua stacks: the main and the thread. Only
  * the main stack can fail. The thread is not manipulated. This function
  * MUST NOT manipulate the created thread stack state, because it is not
- * proctected against errors thrown by the thread stack.
+ * protected against errors thrown by the thread stack.
  */
 int hlua_ctx_init(struct hlua *lua, struct task *task, int already_safe)
 {
@@ -1023,7 +1023,7 @@
 
 	/* Lua cannot yield when its returning from a function,
 	 * so, we can fix the interrupt hook to 1 instruction,
-	 * expecting that the function is finnished.
+	 * expecting that the function is finished.
 	 */
 	if (lua_gethookmask(L) & LUA_MASKRET) {
 		lua_sethook(hlua->T, hlua_hook, LUA_MASKCOUNT, 1);
@@ -1418,7 +1418,7 @@
  *    __pow    "^"
  *    __concat ".."
  *
- * Special methods for redfining standar relations
+ * Special methods for redefining standard relations
  * http://www.lua.org/pil/13.2.html
  *
  *    __eq "=="
@@ -2540,7 +2540,7 @@
 
 	tmout = MS_TO_TICKS((int)dtmout);
 	if (tmout == 0)
-		tmout++; /* very small timeouts are adjusted to a minium of 1ms */
+		tmout++; /* very small timeouts are adjusted to a minimum of 1ms */
 
 	/* Check if we run on the same thread than the xreator thread.
 	 * We cannot access to the socket if the thread is different.
@@ -2598,7 +2598,7 @@
 	memset(socket, 0, sizeof(*socket));
 	socket->tid = tid;
 
-	/* Check if the various memory pools are intialized. */
+	/* Check if the various memory pools are initialized. */
 	if (!pool_head_stream || !pool_head_buffer) {
 		hlua_pusherror(L, "socket: uninitialized pools.");
 		goto out_fail_conf;
@@ -2884,7 +2884,7 @@
 	if (max == 0 && co_data(chn) == 0) {
 		/* There are no space available, and the output buffer is empty.
 		 * in this case, we cannot add more data, so we cannot yield,
-		 * we return the amount of copyied data.
+		 * we return the amount of copied data.
 		 */
 		return 1;
 	}
@@ -2971,7 +2971,7 @@
 
 	/* If there is no space available, and the output buffer is empty.
 	 * in this case, we cannot add more data, so we cannot yield,
-	 * we return the amount of copyied data.
+	 * we return the amount of copied data.
 	 */
 	if (max == 0 && co_data(chn) == 0)
 		return 1;
@@ -3000,7 +3000,7 @@
 
 	/* If there is no space available, and the output buffer is empty.
 	 * in this case, we cannot add more data, so we cannot yield,
-	 * we return the amount of copyied data.
+	 * we return the amount of copied data.
 	 */
 	max = b_room(&chn->buf);
 	if (max == 0 && co_data(chn) == 0)
@@ -3021,7 +3021,7 @@
 	return 1;
 }
 
-/* Just a wraper of "_hlua_channel_send". This wrapper permits
+/* Just a wrapper of "_hlua_channel_send". This wrapper permits
  * yield the LUA process, and resume it without checking the
  * input arguments.
  */
@@ -3038,7 +3038,7 @@
  * forwarded. This function never fails.
  *
  * The Lua function takes an amount of bytes to be forwarded in
- * imput. It returns the number of bytes forwarded.
+ * input. It returns the number of bytes forwarded.
  */
 __LJMP static int hlua_channel_forward_yield(lua_State *L, int status, lua_KContext ctx)
 {
@@ -3686,7 +3686,7 @@
 
 	} else {
 
-		/* Copy the fisrt block caping to the length required. */
+		/* Copy the first block caping to the length required. */
 		if (len1 > len)
 			len1 = len;
 		luaL_addlstring(&appctx->b, blk1, len1);
@@ -3781,7 +3781,7 @@
 	return 1;
 }
 
-/* Just a wraper of "hlua_applet_tcp_send_yield". This wrapper permits
+/* Just a wrapper of "hlua_applet_tcp_send_yield". This wrapper permits
  * yield the LUA process, and resume it without checking the
  * input arguments.
  */
@@ -4312,7 +4312,7 @@
 	return 1;
 }
 
-/* Just a wraper of "hlua_applet_send_yield". This wrapper permits
+/* Just a wrapper of "hlua_applet_send_yield". This wrapper permits
  * yield the LUA process, and resume it without checking the
  * input arguments.
  */
@@ -4326,7 +4326,7 @@
 		WILL_LJMP(lua_error(L));
 	}
 
-	/* This interger is used for followinf the amount of data sent. */
+	/* This integer is used for followinf the amount of data sent. */
 	lua_pushinteger(L, 0);
 
 	return MAY_LJMP(hlua_applet_http_send_yield(L, 0, 0));
@@ -4549,8 +4549,8 @@
 	/* If we dont have a content-length set, and the HTTP version is 1.1
 	 * and the status code implies the presence of a message body, we must
 	 * announce a transfer encoding chunked. This is required by haproxy
-	 * for the keepalive compliance. If the applet annouces a transfer-encoding
-	 * chunked itslef, don't do anything.
+	 * for the keepalive compliance. If the applet announces a transfer-encoding
+	 * chunked itself, don't do anything.
 	 */
 	if ((flags & (HTX_SL_F_VER_11|HTX_SL_F_XFER_LEN)) == HTX_SL_F_VER_11 &&
 	    appctx->appctx->ctx.hlua_apphttp.status >= 200 &&
@@ -5363,7 +5363,7 @@
 }
 
 /* Forward the Reply object to the client. This function converts the reply in
- * HTX an push it to into the response channel. It is response to foward the
+ * HTX an push it to into the response channel. It is response to forward the
  * message and terminate the transaction. It returns 1 on success and 0 on
  * error. The Reply must be on top of the stack.
  */
@@ -6985,7 +6985,7 @@
 	if (unlikely(si->state == SI_ST_DIS || si->state == SI_ST_CLO))
 		goto out;
 
-	/* Check if the input buffer is avalaible. */
+	/* Check if the input buffer is available. */
 	if (!b_size(&res->buf)) {
 		si_rx_room_blk(si);
 		goto out;
@@ -7147,7 +7147,7 @@
 }
 
 /* global {tcp|http}-request parser. Return ACT_RET_PRS_OK in
- * succes case, else return ACT_RET_PRS_ERR.
+ * success case, else return ACT_RET_PRS_ERR.
  *
  * This function can fail with an abort() due to an Lua critical error.
  * We are in the configuration parsing process of HAProxy, this abort() is
@@ -7202,9 +7202,9 @@
 	struct hlua_function *fcn = rule->kw->private;
 
 	/* HTTP applets are forbidden in tcp-request rules.
-	 * HTTP applet request requires everything initilized by
+	 * HTTP applet request requires everything initialized by
 	 * "http_process_request" (analyzer flag AN_REQ_HTTP_INNER).
-	 * The applet will be immediately initilized, but its before
+	 * The applet will be immediately initialized, but its before
 	 * the call of this analyzer.
 	 */
 	if (rule->from != ACT_F_HTTP_REQ) {
@@ -7893,7 +7893,7 @@
 	enum hlua_exec ret;
 	const char *error;
 
-	/* Call post initialisation function in safe environement. */
+	/* Call post initialisation function in safe environment. */
 	if (!SET_SAFE_LJMP(gL.T)) {
 		if (lua_type(gL.T, -1) == LUA_TSTRING)
 			error = lua_tostring(gL.T, -1);
diff --git a/src/log.c b/src/log.c
index 2d92664..c2153b8 100644
--- a/src/log.c
+++ b/src/log.c
@@ -613,7 +613,7 @@
 				var = str;
 			}
 			else if (*str == '%')
-				cformat = LF_TEXT;     // convert this character to a litteral (useful for '%')
+				cformat = LF_TEXT;     // convert this character to a literal (useful for '%')
 			else if (isdigit((unsigned char)*str) || *str == ' ' || *str == '\t') {
 				/* single '%' followed by blank or digit, send them both */
 				cformat = LF_TEXT;
@@ -625,7 +625,7 @@
 
 			}
 			else
-				cformat = LF_INIT;     // handle other cases of litterals
+				cformat = LF_INIT;     // handle other cases of literals
 			break;
 
 		case LF_STARG:                         // text immediately following '%{'
@@ -726,7 +726,7 @@
 }
 
 /*
- * Parse the first range of indexes from a string made of a list of comma seperated
+ * Parse the first range of indexes from a string made of a list of comma separated
  * ranges of indexes. Note that an index may be considered as a particular range
  * with a high limit to the low limit.
  */
@@ -1364,7 +1364,7 @@
 
 /*
  * Write a IP address to the log string
- * +X option write in hexadecimal notation, most signifant byte on the left
+ * +X option write in hexadecimal notation, most significant byte on the left
  */
 char *lf_ip(char *dst, const struct sockaddr *sockaddr, size_t size, const struct logformat_node *node)
 {
@@ -1402,7 +1402,7 @@
 
 /*
  * Write a port to the log
- * +X option write in hexadecimal notation, most signifant byte on the left
+ * +X option write in hexadecimal notation, most significant byte on the left
  */
 char *lf_port(char *dst, const struct sockaddr *sockaddr, size_t size, const struct logformat_node *node)
 {
diff --git a/src/standard.c b/src/standard.c
index eba7910..e3e81ba 100644
--- a/src/standard.c
+++ b/src/standard.c
@@ -1142,7 +1142,7 @@
 /*
  * converts <str> to two struct in_addr* which must be pre-allocated.
  * The format is "addr[/mask]", where "addr" cannot be empty, and mask
- * is optionnal and either in the dotted or CIDR notation.
+ * is optional and either in the dotted or CIDR notation.
  * Note: "addr" can also be a hostname. Returns 1 if OK, 0 if error.
  */
 int str2net(const char *str, int resolve, struct in_addr *addr, struct in_addr *mask)
@@ -1193,7 +1193,7 @@
 /*
  * converts <str> to two struct in6_addr* which must be pre-allocated.
  * The format is "addr[/mask]", where "addr" cannot be empty, and mask
- * is an optionnal number of bits (128 being the default).
+ * is an optional number of bits (128 being the default).
  * Returns 1 if OK, 0 if error.
  */
 int str62net(const char *str, struct in6_addr *addr, unsigned char *mask)
@@ -1276,7 +1276,7 @@
 
 /*
  * Resolve destination server from URL. Convert <str> to a sockaddr_storage.
- * <out> contain the code of the dectected scheme, the start and length of
+ * <out> contain the code of the detected scheme, the start and length of
  * the hostname. Actually only http and https are supported. <out> can be NULL.
  * This function returns the consumed length. It is useful if you parse complete
  * url like http://host:port/path, because the consumed length corresponds to
@@ -2187,9 +2187,9 @@
 
 /*
  * Parse binary string written in hexadecimal (source) and store the decoded
- * result into binstr and set binstrlen to the lengh of binstr. Memory for
+ * result into binstr and set binstrlen to the length of binstr. Memory for
  * binstr is allocated by the function. In case of error, returns 0 with an
- * error message in err. In succes case, it returns the consumed length.
+ * error message in err. In success case, it returns the consumed length.
  */
 int parse_binary(const char *source, char **binstr, int *binstrlen, char **err)
 {
@@ -2403,7 +2403,7 @@
 /* Converts any text-formatted IPv4 address to a host-order IPv4 address. It
  * is particularly fast because it avoids expensive operations such as
  * multiplies, which are optimized away at the end. It requires a properly
- * formated address though (3 points).
+ * formatted address though (3 points).
  */
 unsigned int inetaddr_host(const char *text)
 {
@@ -3765,7 +3765,7 @@
 /* removes environment variable <name> from the environment as found in
  * environ. This is only provided as an alternative for systems without
  * unsetenv() (old Solaris and AIX versions). THIS IS NOT THREAD SAFE.
- * The principle is to scan environ for each occurence of variable name
+ * The principle is to scan environ for each occurrence of variable name
  * <name> and to replace the matching pointers with the last pointer of
  * the array (since variables are not ordered).
  * It always returns 0 (success).
diff --git a/src/stats.c b/src/stats.c
index 36be315..46475cc 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -3276,7 +3276,7 @@
 	if (unlikely(si->state == SI_ST_DIS || si->state == SI_ST_CLO))
 		goto out;
 
-	/* Check if the input buffer is avalaible. */
+	/* Check if the input buffer is available. */
 	if (!b_size(&res->buf)) {
 		si_rx_room_blk(si);
 		goto out;
@@ -3397,7 +3397,7 @@
 }
 
 /* Fill <info> with HAProxy global info. <info> is preallocated
- * array of length <len>. The length of the aray must be
+ * array of length <len>. The length of the array must be
  * INF_TOTAL_FIELDS. If this length is less then this value, the
  * function returns 0, otherwise, it returns 1.
  */
diff --git a/src/task.c b/src/task.c
index e6be240..f58e5f9 100644
--- a/src/task.c
+++ b/src/task.c
@@ -277,7 +277,7 @@
 
 /* Checks the next timer for the current thread by looking into its own timer
  * list and the global one. It may return TICK_ETERNITY if no timer is present.
- * Note that the next timer might very well be slighly in the past.
+ * Note that the next timer might very well be slightly in the past.
  */
 int next_timer_expiry()
 {