2011-02-03  Sergey Poznyakoff  <gray@gnu.org.ua>

	Update the docs.

2011-02-02  Sergey Poznyakoff  <gray@gnu.org.ua>

	Bugfixes.

	* src/pdu.c (joh_pdu_decode): Set sess->http_type to joh_http_poll.
	* doc/joh.texi: Document HTTP Connect.
	* configure.ac: Update. Version 1.1.
	* NEWS: Update.

	Implement ACLs for outgoing jabber connections.

	* src/acl.c (destination_allowed): New function.
	* src/joh.h (destination_allowed): New proto.
	* src/socket.c (new_jabber_connection): Check if the requested
	jabber connection is allowed by TCP wrappers.

	Minor fixes.

	* src/selloop.c (_netio_jabber): Close the session and its peer on EOF.
	* src/sess.c (joh_session_destroy): Ignore NULL argument.

	Fix memory management errors.

	* src/sess.c (joh_session_destroy): Free sess->sa.
	(joh_session_lookup): Realloc param[joh_param_id].ptr.

	Remove exception fdset: it is not needed.

	* src/joh.h (FDSET_EX): Remove.
	(_FDSET_MAX): New constant.
	* src/selloop.c: Remove references to FDSET_EX
	* src/socket.c: Likewise.

2011-02-01  Sergey Poznyakoff  <gray@gnu.org.ua>

	Minor rearrangements.

	* src/poll.c: New file.c
	* src/Makefile.am (johd_SOURCES): Add poll.c
	* src/joh.h (FDMASK_RD,FDMASK_WR,FDMASK_EX): New constants.
	 (joh_session_unlink): New proto.
	(joh_http_poll_setup,joh_http_poll_flush)
	(joh_http_transparent_flush)
	(joh_http_connect_flush): New protos.

	* src/selloop.c: Use FDMASK_* constants.
	* src/socket.c: Likewise.

	* src/sess.c (session_unlink): Rename to joh_session_unlink (extern).
	All uses updated.
	(joh_http_poll_setup,joh_http_poll_flush): Move to poll.c
	(joh_http_connect_setup,joh_http_transparent_setup): Remove.
	(joh_http_connect_flush,joh_http_transparent_flush): Move
	to transparent.c

	Implement "HTTP CONNECT" proxy.

	* src/pdubuf.c: New file.
	* src/transparent.c: New file.
	* src/Makefile.am (libjoh_a_SOURCES): Add pdubuf.c
	(johd_SOURCES): Add pdu.c and transparent.c.
	* src/conntab.c (client_class_str): New type "transparent".
	* src/http.c (http_type_str): New variable.
	(split_request); Request is const.
	(parse_http_request): Take 2 arguments: session and request string.
	(joh_http_decode): Take single argument: a session.
	(poll_reply_tab, connect_reply_tab): New arrays.
	(http_response): Take struct reply_fmt* as first arg.
	(joh_http_encode): Take three args.
	* src/interp.c (interpreter): Change member signatures.
	All uses updated.
	(joh_param_check): New function.
	* src/joh.h (joh_client_class): New class client_transparent.
	(joh_http_type): New enum.
	(joh_client_dir): New enum.
	(joh_session)<sa, http_type>: New members.
	(joh_session_create): Change signature.
	(joh_client_session_setup, joh_client_session_flush): New protos.
	(joh_pdu_decode_session): Remove.
	(joh_pdu_encode_buf, joh_pdu_decode_buf): New protos.
	(joh_pdu_encode, joh_pdu_decode): Change signature.
	(joh_data_decode): Change signature.
	(joh_http_decode, joh_http_encode): Change signature.
	(parse_post_query, parse_connect_query)
	(joh_transparent_decode, joh_transparent_encode): New protos.
	(joh_obuf_free): New proto.
	* src/johcgi.c (param_names): Remove.
	(jabber_data): Call parse_post_query.
	(main): Call joh_pdu_encode_buf and joh_pdu_decode_buf.
	* src/pdu.c (joh_pdu_decode, joh_pdu_encode): Rewrite as
	wrappers over the corresponding *_buf functions.
	Change signatures.
	* src/selloop.c (_netio_client): Call joh_client_* functions
	for session maintenance.
	(_netio_jabber): Use joh_obuf_free.
	Add peer to wr set after successful read.
	(_netio_client): Handle EOF return from recv.
	* src/sess.c (joh_session_create): Take a pointer to joh_session
	in the third arg. Store it in sess->sa.
	(joh_http_poll_setup, joh_http_poll_flush)
	(joh_http_connect_setup, joh_http_connect_flush)
	(joh_http_transparent_setup, joh_http_transparent_flush): New static
	functions.
	(joh_client_session_setup, joh_client_session_flush): New functions.
	(joh_session_destroy): Destroy peer session, if it is not linked in
	the timeout chain (this happens if it is a jabber session associated
	with a transparent (HTTP Connect) proxy client.
	(joh_session_destroy): Use joh_obuf_free.
	* src/socket.c: Additional debugging.
	* src/util.c (parse_http_query): Rename to parse_post_query.
	(parse_connect_query): New function.
	(joh_obuf_free): New function.

	Bugfix.

	* src/socket.c (joh_add_fd): Fix iteration limit.

2011-01-31  Sergey Poznyakoff  <gray@gnu.org.ua>

	Minor fixes in HTTP code.

	* src/http.c (find_eol): Return boolean.
	(SKIPWS): Remove macro.
	(free_request_array,split_request): New protos.
	(parse_post_request): Use split_request.
	Fix possible NULL dereference.

2011-01-30  Sergey Poznyakoff  <gray@gnu.org.ua>

	Improve max_fd calculations.

	* src/conntab.c (joh_connection_iterate): New third argument
	instructs to iterate over all connections, no matter what their
	inset flag is.
	* src/joh.h (joh_connection_iterate): Change signature.
	* src/selloop.c (joh_loop): Fix call to joh_connection_iterate.
	* src/socket.c (joh_max_fd): Initialize to -1.
	(joh_rem_fd): Reduce number of iterations.
	(joh_chg_fd): Rewrite in more effective way. Recompute joh_max_fd.
	(joh_listen_socket_cleanup): Rewrite via joh_connection_iterate.
	Reset joh_max_fd.

2011-01-29  Sergey Poznyakoff  <gray@gnu.org.ua>

	Update docs.  Add some more debugging.

2011-01-28  Sergey Poznyakoff  <gray@gnu.org.ua>

	Switch to deep directory structure, add a boilerplate for texi docs.

	Implement daemon mode and logging to syslog.

	* Makefile.am (EXTRA_DIST): New var.
	* daemon.c: New file.
	* configure.ac: Check for daemon.
	* error.c: Implement logging to syslog.
	* joh.h (prefix_severity_option, facility_option)
	(log_tag): New externs.
	(joh_initlog): New proto.
	* johd.c (pidfile): New global.
	(joh_check_pidfile, joh_remove_pidfile, joh_write_pidfile): New functions.
	(main): Implement new options: -D, -p, -F, -L, -P.
	Switch to background if requested.

	Configurable, per-socket TCP wrapper daemon names.

	* joh.h (joh_sockaddr) <srvname>: New member.
	(JOH_HINT_SRVNAME): New flag.
	(joh_sockaddr_hints) <srvname>: New member.
	(connection_allowed): Change signature.
	* johd.c: New option -S.
	The -c option affects the default port number (80 for HTTP).
	* netaddr.c (parse_unix): Set srvname to NULL.
	(parse_inet): Set srvname according to hints.
	* selloop.c (_netio_master): Print service (daemon) name in the
	blocked access diagnostics message.
	Set class and srvname of jsa to those of sa.
	* acl.c (connection_allowed): Take second argument, specifying the
	daemon name to use with TCP wrappers.
	(joh_daemon_name): Remove global.

	Implement direct HTTP support in daemon.

	* http.c: New file.
	* interp.c: New file.
	* util.c: New file.
	* Makefile.am (libjoh_a_SOURCES): Add util.c
	(johd_SOURCES): Add interp.c and http.c.

	* cbuf.c (copy_chars, joh_cbuf_append): Buffer is const char *.
	* conntab.c (client_class_str): New variable.
	(joh_connection_client_class): New function.
	* joh.h (joh_client_class): New enum.
	(joh_sockaddr) <class>: New member.
	(joh_sockaddr_hints) <class>: New member.
	(joh_cbuf_append): Change signature.
	(client_class_str): New extern.
	(joh_session) <decstate>: New member.
	(joh_pdu_decode): Change signature.
	(param_str): New extern.
	(joh_data_decode, joh_data_encode)
	(joh_http_decode, joh_http_encode)
	(store_param, unescape_query)
	(parse_http_query, parse_content): New protos.
	* johcgi.c (store_param, parse_content)
	(unescape_query): Move to the library. All uses changed.
	* johd.c: Implement -c option.
	* netaddr.c (parse_unix, parse_inet): Handle JOH_HINT_CLASS flag.
	* pdu.c (param_str): Remove static qualifier.
	(joh_pdu_decode): Change signature.
	(joh_pdu_decode_session): Remove.
	* selloop.c (_netio_master): Set joh_sockaddr class.
	(_netio_jabber): Improve packet dump format.
	(_netio_client): Likewise.
	Use joh_data_ functions.
	* sess.c (joh_session_destroy): Free decstate.
	* socket.c (new_jabber_connection): Remove AI_NUMERIC flags.

2011-01-27  Sergey Poznyakoff  <gray@gnu.org.ua>

	Minor fixes in manpage formatting.

	Minor change in README.

	Minor changes in error reporting.

	Configurable timeouts.

	* joh.h (joh_session_set_timeout): New proto.
	* johd.c: new option -t
	* sess.c (joh_session_set_timeout): New function.

	Minor fixes in URL parser.

	* johcgi.c (joh_connect): Don't use JOH_HINT_BIND.
	* netaddr.c (parse_inet): Allow NULL node.
	Unless family == AF_UNSPEC, select only those sockaddrs that match
	the family.

	Add manpages.

	* joh.cgi.8: New file.
	* johd.8: New file.
	* Makefile.am (dist_man_MANS): New var.

2011-01-26  Sergey Poznyakoff  <gray@gnu.org.ua>

	Redesign PDU.

	Bugfix.

	* netaddr.c (parse_inet): Fix parsing IPv6 addresses.

	Improve -l and -s option parsers.

	* error.c (source_info_option): New global.
	(debug_begin_out): New function.
	* joh.h (debug_begin_out): New proto.
	(source_info_option): New extern.
	(debug): Use debug_begin_out.
	(joh_add_fd,joh_rem_fd,joh_chg_fd): Void functions.
	* johcgi.c (fallback_jabber_data): Remove unused vars.
	* johd.c: New option -i.
	* netaddr.c: Include ctype.h
	(good_ipaddr,is_numstr): New functions.
	(parse_inet): Allow for single IP addresses or single port number
	as argument.
	* selloop.c, sess.c, socket.c: Minor fixes.

	Minor fix.

	* selloop.c (_netio_client): Report invalid keys and session ids
	back to the caller.

	Housekeeping: add bootstrap and add some generic docs.

2011-01-25  Sergey Poznyakoff  <gray@gnu.org.ua>

	Implement a CGI interface.

	Minor fix.

	* selloop.c (_netio_client): Honor newkey.

	Include config.h in joh.h

	Update copylefts.

2011-01-24  Sergey Poznyakoff  <gray@gnu.org.ua>

	Autoconfiscate.

	Optimize

	* conntab.c (connection) <next,prev,inset>: New members.
	(conntab_head, conntab_tail): New variables.
	(joh_connection_inset): New function.
	(joh_connection_register): Keep a doubly-lined list of active descriptors.
	(joh_connection_iterate): Iterate over the list, ignoring fds with inset=0.
	* joh.h (FDSET_RD, FDSET_WR, FDSET_EX): New constants
	(FDMASK): New macro
	(IOBUFSIZE): New constant.
	(joh_connection_inset): New proto.
	(joh_session_state): Remove. All uses updated.
	(joh_connect_set): Remove.
	(joh_fd_set): New global.
	(joh_listen_socket_setup): Change signature.
	All uses updated.
	* selloop.c: Update joh_fd_set as needed.
	* sess.c: Likewise.
	* socket.c (joh_connect_set): Remove.
	(joh_add_fd): Take second argument.
	(joh_rem_fd): Update.
	(joh_chg_fd): New function.

	Finish initial implementation.

	* key.c: New file.
	* Makefile (SRCS): Add key.c
	* cbuf.c (joh_cbuf_create): Initialize .free.
	* client.c (client_decode): update.
	(client_encode): New function.
	* joh.h (joh_param): Rename to joh_param_key.
	(joh_param, joh_obuf): New structs.
	(joh_session) <cbuf>: Remove.
	<ibuf,obuf>: New members.
	<param>: Change data type.
	(client_encode, joh_validate_key): New prototypes.
	* selloop.c (_netio_jabber): Implement.
	(_netio_client): Various fixes.
	(set_signals): Bugfix.
	* sess.c, sessid.c, socket.c: Update.

	Read and decode incoming client packs.

	* client.c: New file.
	* Makefile (SRCS): Add client.c
	* conntab.c (conn_type_str): New global.
	(joh_connection_iterate): Ignore unused sockets.
	* error.c (joh_format_vbuf, joh_logdump): New functions.
	* joh.h: Add missing includes,
	(JOH_VBUFSIZE): New define.
	(joh_format_vbuf, joh_logdump): New protos.
	(conn_type_str): New extern.
	(joh_session_state,joh_param): New enums.
	(joh_session) <state.peer,param>: New members.
	<id,key>: Remove.
	(joh_session_lookup): Change signature.
	(new_jabber_connection): Change signature.
	(client_decode): New proto.
	* johd.c (main): Call joh_loop.
	* selloop.c (_netio_client): Initial implementation.
	(joh_loop): Handle common signals.

	* sess.c (joh_session_promote): Fix call to time.
	(joh_session_create): Likewise.
	(joh_session_destroy): Update
	(joh_session_lookup): Take a pointer to struct joh_session as argument.
	* socket.c (new_jabber_connection): Take 2 args.
	Use "server" and "port" parameters, if present.

	Further development of the session support.

	* Makefile (SRCS): Add acl.c and selloop.c
	* acl.c: New file.
	* selloop.c: New file.
	* conntab.c (getmaxfd): New function.
	(joh_connection_iterate): New function.
	* joh.h (joh_sockaddr) <sess>: New  member.
	(joh_sockaddr_new): Change signature.
	(joh_sockaddr_copy): New proto.
	(sockaddr_str): New proto.
	(joh_connection_iterate): New proto.
	(joh_session) <type>: New member.
	(joh_session_create): Change signature.
	(joh_connect_set,joh_max_fd): New externs.
	(joh_add_fd, joh_rem_fd, new_jabber_connection): New protos.
	(connection_allowed): New proto.
	(jabber_addr): New extern.
	* netaddr.c (joh_sockaddr_new): Change signature.
	(joh_sockaddr_copy): New function.
	(sockaddr_str): New function.
	* sess.c (joh_session_timeout_table): New variable.
	(joh_session_create): Rewrite.
	(joh_session_destroy): Unregister the fd.
	(joh_session_timeout): New function.
	* socket.c (joh_max_fd): New global.
	(joh_add_fd, joh_rem_fd): New functions.
	(setup_listen_socket): Register the fd.
	(new_jabber_connection): New function.

2011-01-23  Sergey Poznyakoff  <gray@gnu.org.ua>

	Add new functionality

	* conntab.c: New file.
	* socket.c: New file.
	* Makefile (SRCS): Add conntab.c & socket.c.
	* joh.h: Add more includes.
	(getmaxfd): New define.
	(joh_sockaddr) <str>: New member.
	(joh_sockaddr_str): New function.
	(joh_conntype): New struct.
	(joh_conntab_init, joh_connection_type)
	(joh_connection_address, joh_connection_register): New protos.
	(joh_listen_socket_setup,joh_listen_socket_cleanup): New protos.
	* johd.c (main): Open and close sockets.
	* mem.c (xstrdup): Bugfix. Wrong value was returned.
	* netaddr.c (joh_sockaddr_append): Likewise.
	(joh_sockaddr_free): Free str.
	(joh_sockaddr_str): New function.

	Add base64, sha1 and session support.

2011-01-22  Sergey Poznyakoff  <gray@gnu.org.ua>

	Initial commit

Local Variables:
mode: change-log
version-control: never
buffer-read-only: t
End:
