Commit Graph

36 Commits

Author SHA1 Message Date
Robert James Kaes
523f2003fa Removed the DNS API calls and replaced them with the standard
gethostbyname() and gethostbyaddr() functions.  This is possible
because tinyproxy now uses a standard pre-forked() method.
2002-05-26 18:51:17 +00:00
Robert James Kaes
a34db10d65 Fixed some spelling mistakes, and removed the getpeer_ip() and
getpeer_string() functions as they've been replaced by the
getpeer_information() function.
2002-05-24 04:44:36 +00:00
Robert James Kaes
478030c6ff Changed the lookup_domain() function to use the new "dnsserver" API.
Also moved safe_write(), safe_read(), readline(), and write_message()
functions into their own file.
2002-05-23 18:25:55 +00:00
Robert James Kaes
d7c3f23610 bind_address has been moved inside the config structure. Fixed up a
problem where "data" was being freed even if it had not been allocated
(because of an error condition.)
2002-04-24 16:48:34 +00:00
Robert James Kaes
08077cc9e1 The "Bind" directive sets a binding address which the outgoing connections
will use.
2002-04-22 19:35:24 +00:00
Robert James Kaes
aa68eb8540 Whoops. The previous include only had the code conditionally removed.
Remove for real this time.
2002-04-18 21:54:50 +00:00
Robert James Kaes
1db154464e Removed the call to inet_aton() since the gethostbyname() function handles
the dotted-decimal case itself.
2002-04-18 21:53:33 +00:00
Robert James Kaes
73a53daf38 Removed the call to hstrerror() in the getpeer_string() function. It's
not available on all machines.
2002-04-18 18:48:22 +00:00
Robert James Kaes
3e60a5b819 Removed the LOOKUP_LOCK() and LOOKUP_UNLOCK() macros since I believe I
need locking around both gethostbyname() and gethostbyaddr() at the same
time.
2002-04-17 20:56:13 +00:00
Robert James Kaes
0e4436a070 Tightened the lookup_domain() function. 2002-04-16 03:21:46 +00:00
Robert James Kaes
4b7de22999 Added a test to make sure the "whole_buffer" could be allocated. 2002-04-15 04:16:01 +00:00
Robert James Kaes
c86d22226f Added additional error handling for the bind() and listen() system calls
when setting up the listening socket.
2002-04-13 19:03:18 +00:00
Robert James Kaes
be47c1791d Modified the opensock() function to respect the Listen directive. If it's
set, bind all outgoing addresses to this local address.
2002-04-13 05:20:19 +00:00
Robert James Kaes
b10221fa07 Added the write_message() function (from reqs.c) 2001-12-24 00:01:32 +00:00
Robert James Kaes
7240af4333 Changed the calls to write() to send() so that we can use send(...,
MSG_NOSIGNAL) and not get signals sent to the process. (easier for
debugging and the system doesn't need to worry about signals.)
2001-12-19 20:41:28 +00:00
Robert James Kaes
fdb4952e5f Added the assert() calls to safe_write() to make sure the arguments are
sane.
2001-12-17 00:00:24 +00:00
Robert James Kaes
b969ed4302 Changed safe_write() to fully send all the data in the buffer it was
passed. Also safe_write() and safe_read() now use char pointer buffers
rather than the void pointer style.
2001-12-15 20:04:04 +00:00
Robert James Kaes
a4934e2232 Added the host name lookup code (which use to be in the DNS caching
system.)
2001-12-15 05:58:30 +00:00
Robert James Kaes
8dc7035fbc Add support to limit the maximum size of the input line (to 128KB which
should be _more_ than enough for any header line. :)
2001-11-25 02:21:46 +00:00
Robert James Kaes
fd3b313e9f Style changes. Also replaces all mallocs with safemalloc, etc. 2001-11-23 01:18:43 +00:00
Robert James Kaes
d08d088d4a Replaced the readline() function with a new version which has no
restrictions on the length of a line (unless you fill memory of course.)
Reformated the source.
2001-11-22 00:19:18 +00:00
Robert James Kaes
dde4e9adcc Changed the read() call into a recv() call with a flag of NOSIGNAL since I
don't want signals messing up my calling conventions.
2001-11-12 21:10:51 +00:00
Robert James Kaes
5f8ee4fae3 Bit of source code clean up. 2001-10-25 05:10:32 +00:00
Robert James Kaes
b7b4d08758 Error message cleanup to make the information more informative. 2001-10-24 00:37:23 +00:00
Robert James Kaes
7d7958b0d7 Fixed a spelling problem in a log message. 2001-10-23 16:43:08 +00:00
Robert James Kaes
a746b9d0b2 Moved the zero-length string setting to outside the tests in getpeer_*()
functions. Also added a more robust error reporting for DNS errors.
2001-10-23 03:57:34 +00:00
Robert James Kaes
a6a026cb9e Changed the getpeer_*() functions to return the reason why the name or IP
address could not be looked up.
2001-10-22 16:52:34 +00:00
Robert James Kaes
ad743c1e41 Fixed a problem where a user's variable would be uninitialized if a DNS
lookup failed.
2001-10-22 15:56:11 +00:00
Robert James Kaes
b9c4c480d2 Moved the safe_write() and safe_read() functions here. 2001-09-16 20:11:07 +00:00
Robert James Kaes
1a9dc4e7e8 Error message cleanup. 2001-09-07 04:21:07 +00:00
Robert James Kaes
fcff398f31 Cleaned up the locking code to make it more fine grained. Did this since
dncache.c has locking itself now.
2001-08-29 04:00:22 +00:00
Robert James Kaes
42b09e5441 Removed the SA define.
Made the sock_mutex static since it's not referenced outside the file.
Changed the data types for some of the variables.
Cleaned up the readline function (changed data types and removed
variables.)
2001-05-27 02:31:20 +00:00
Robert James Kaes
d32e0d1ccb Added ASSERT statements. 2001-05-23 18:01:23 +00:00
Robert James Kaes
f6b7fe3f5c Needed locking in getpeer_string().
Added mutex locking around the dnscache() call.
Removed the global sockaddr and setup_fd variables.
Added the socket_blocking() and socket_nonblocking() functions.
Gutted the readling() function and replaced it with something similar to
the 1.0 version. :)
2000-09-11 23:56:32 +00:00
Robert James Kaes
2562d28129 Completely rewrote the readline function. 2000-03-31 20:10:13 +00:00
Steven Young
37e63909c0 This commit was generated by cvs2svn to compensate for changes in r2,
which included commits to RCS files with non-trunk default branches.
2000-02-16 17:32:49 +00:00