Commit Graph

53 Commits

Author SHA1 Message Date
Robert James Kaes
fb736ec3fb A _tonne_ of changes. It would almost be easier to just read the source
itself to find out all the changes.  Changed the process_client_header()
function to use the hashmap and vector modules.  I've made this change to
better handle the Connection header.  The Connection header, it it's
present, lists all the headers which should _not_ be transmitted any
further along.  An HTTP/1.1 proxy must respect this.

Other changes are basically cosmetic.
2002-04-07 21:35:59 +00:00
Robert James Kaes
475e526a48 Moved write_message() into sock.c because I'm using it in other places. 2001-12-24 00:01:02 +00:00
Robert James Kaes
c3124815a1 Cleaned up the code which sends the "Via" header. It now uses
write_message().
2001-12-23 21:55:08 +00:00
Robert James Kaes
93f0406b7e Created the CHECK_CRLF() macro to handle the tests for the appropriate
control characters in a string.
2001-12-20 04:48:32 +00:00
Robert James Kaes
63a1fa96cc Removed duplicate code from process_server_headers() and removed the calls
to strlen(); readline() already returns the length of the string, so use
that instead.
2001-12-19 20:40:23 +00:00
Robert James Kaes
e964cf0d35 Damn---removed the debugging code from write_message(). 2001-12-19 05:20:01 +00:00
Robert James Kaes
5140f01d5c Opps! Fixed a problem with negative numbers. :) 2001-12-19 05:19:03 +00:00
Robert James Kaes
56b541d76b Redefined HTTP_LINE_LENGTH to be based on MAXBUFFSIZE (and set to around
16 KB.)

Added the TUNNEL_CONFIGURED() macro to help with testing for the tunnel
support code.

Create the write_message() function to encapsulate the code which sends
the information to the file descriptor.

Moved the tunnel code into it's own function.
2001-12-19 05:13:40 +00:00
Robert James Kaes
17103bf8fe Updated the list of headers to ignore. 2001-12-18 05:01:03 +00:00
Robert James Kaes
faf655c5db Added the code to log the request when in tunnelling mode. 2001-12-17 19:10:56 +00:00
Robert James Kaes
9448787ff2 Added UPSTREAM_CONFIGURED() macro to help clean up the code.
Ignore any blank lines when tinyproxy is expecting a request line.

Instead of sending the request line to the remote server in pieces,
tinyproxy nows sends it in once go. This was done to fix a problem with
some sites like www.heise.de.

Changed all calls to connptr->ssl to connptr->connect_method.

Changed all calls to connptr->send_message to
connptr->send_response_message.

Moved the call to Via header code to inside to the tests to handle if
tinyproxy is sending an error message (don't need to send any headers.)
2001-12-17 00:11:32 +00:00
Robert James Kaes
c6c7427e8d Removed the trim() function and move it into chomp()/utils.c 2001-11-23 01:17:19 +00:00
Robert James Kaes
787ece6c01 Reformated text. 2001-11-22 00:31:10 +00:00
Robert James Kaes
1fa9d257c2 Replaced the calls to the old readline() function with calls to the new
version.
2001-11-22 00:19:45 +00:00
Robert James Kaes
a30eb425e3 #if 0'd the code handling the "Via" header in the process_client_headers()
function since I'm not completely happy with the code.
2001-11-21 19:19:46 +00:00
Robert James Kaes
90ee7e01ca Extract the version from the request line and store it in the conn_s
structure.
Don't send a Connection header to the remote connection.
Handle the Via header correctly.
2001-11-21 00:59:33 +00:00
Robert James Kaes
ddb002d57e Replaced all calls to buffer_size() with the macro BUFFER_SIZE(). 2001-11-05 15:23:34 +00:00
Robert James Kaes
e61424a7bf Informing the user of the connection to the tunnel is a INFO type message,
not a CONN level message.
2001-11-02 21:19:46 +00:00
Robert James Kaes
d3b099140f Some code clean up due to the creation of the conns.{c,h} files which now
store the creation/destruction and definition of the connection structure.
2001-10-25 16:58:50 +00:00
Robert James Kaes
1bbf32f04c Fixed the problems with sending/not sending headers so that the CONNECT
(SSL) method would work with upstream proxying!
2001-10-25 05:12:46 +00:00
Robert James Kaes
6afa56ba09 Changed the way relay_connection() works by having the both buffers
emptied when either socket is closed. This should be better for the tunnel
connections.
Change the connect_to_upstream() function to better utilize the
establish_http_connection() function. Code re-use is cool. :)
2001-10-25 04:40:48 +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
358b2781af Cleaned up the code in handle_connection() and added a NULL pointer test
in the free request function.
2001-10-22 16:08:29 +00:00
Robert James Kaes
b40e382e5a More moving around of the source code. Still can't get CONNECT to work
with an upstream proxy.
2001-10-19 18:03:49 +00:00
Robert James Kaes
7a613287ee Trying to allow CONNECT methods through an Upstream proxy. 2001-10-17 04:15:35 +00:00
Robert James Kaes
08baf6b01b Moved the safe_read() and safe_write() functions into the sock.c file
since they're now used in other places.

Added support for a true upstream proxy connection. This involved some
rewriting of the handle_connection() function and some of the support
functions so that they do perform the domain filtering and anonymous
filtering while still connecting to the upstream proxy. I think the code
should be cleaned up further.
2001-09-16 20:10:19 +00:00
Robert James Kaes
b7fc58333b Removed the log messages related to memory allocation.
Move the SSL response header into into own function.
Added support for the status host.
2001-09-15 21:26:14 +00:00
Robert James Kaes
ea4d707d12 Finally got the SSL problem fixed. We can not send _any_ client headers
(including the new line) to the origin server when in tunnelling mode. SSL
now works correctly. Yeah.
2001-09-14 21:16:56 +00:00
Robert James Kaes
9c520c7a50 Changed the buffer pointer in safe_write() to be const void* since we're
not changing the values.

Instead of building a new request and memory, simply send each part
separately. Actually uses less memory _and_ less code.
2001-09-14 19:50:45 +00:00
Robert James Kaes
c6d2e0f7ff Massive changes. Split process_method() into a bunch of smaller files and
changed the parsing code from REGEX and uri.c to a simplier sscanf()
method. Also, include code to handle SSL connections, but that's not quite
working yet.
2001-09-14 04:56:29 +00:00
Robert James Kaes
c48aea165d Fixed memory leak. 2001-09-12 03:33:15 +00:00
Robert James Kaes
f8edd2d8b4 Switched the memory allocation for the large strings to heap based instead
of stack based.
2001-09-11 19:26:49 +00:00
Robert James Kaes
0668e42e8f Changed all the mallocs and callocs to use the new safemalloc and
safecalloc.
2001-09-08 18:58:37 +00:00
Robert James Kaes
1a9dc4e7e8 Error message cleanup. 2001-09-07 04:21:07 +00:00
Robert James Kaes
c937858ec1 Moved the compare_header() test after the skip header test. 2001-09-04 18:22:00 +00:00
Robert James Kaes
22bdb8123d Replaced the call to xstrstr() with strstr(). 2001-08-30 16:51:10 +00:00
Robert James Kaes
f9d0fcd1a2 Moved the strip new line/carriage return from the end of a line into a
separate function.
2001-08-28 04:32:14 +00:00
Robert James Kaes
771425700d Fixed a SEGV problem with invalid requests. 2001-08-27 03:44:22 +00:00
Robert James Kaes
af10311eaf Fixed a problem with the Anonymous filtering. Basically, anonymous
filtering was not working in the previous version.
2001-08-26 21:11:55 +00:00
Robert James Kaes
5b11a1e2c9 Formating changes. Also, explictly close the client_fd when the
connections are destroyed.
2001-05-30 15:45:14 +00:00
Robert James Kaes
981adafb5d Changed some of the types to Posix data types.
Changed any reference to log() to log_message().
Fixed a potential memory leak in process_method().
Removed redundant code and variables in relay_connection().
2001-05-27 02:29:06 +00:00
Robert James Kaes
03ffa590b7 Just a formatting change. 2001-05-23 17:58:19 +00:00
Robert James Kaes
93b201d23b Fixed more potential overflow bugs. 2001-01-15 17:11:57 +00:00
Robert James Kaes
b023ff577f Changed the filter_host command to filter_url. 2000-11-23 04:46:25 +00:00
Robert James Kaes
fd61e791b5 Updated the free() calls to the safefree() calls. 2000-09-26 04:57:46 +00:00
Robert James Kaes
392c97e3d1 MAJOR RE-WRITE! Read the ChangeLog and look at the source. It's shorter
than redocumenting the changes here. :)
2000-09-12 00:04:42 +00:00
Robert James Kaes
d0a05357a1 Fixed a bug with the path in clientreq. If the path was empty it caused a
malformed request to be sent.
2000-03-31 22:55:22 +00:00
Robert James Kaes
dede5f36a8 Updated the anonheader function to use the new anonymous API. Removed the
hack for the POST method in clientreq.
2000-03-31 20:13:36 +00:00
Robert James Kaes
0d421b5c39 Fixed a bug with the clientreq function which was incorrectly setting the
clientheader flag and causing _all_ headers to be sent even in anonymous
mode.
2000-03-29 16:17:37 +00:00
Robert James Kaes
46076808fb Fixed another NULL bug with the uri->authority. If an badly formed request
was made in the form of http:\\www.somewhere.com/ tinyproxy would SEGV.
This has been corrected.
2000-03-28 16:41:45 +00:00