/*
- * $Id: ACLChecklist.cc,v 1.12 2003/05/18 00:04:07 robertc Exp $
+ * $Id: ACLChecklist.cc,v 1.13 2003/07/11 01:40:33 robertc Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
/* the checklist lock */
authenticateAuthUserRequestUnlock(auth_user_request);
/* it might have been connection based */
- assert(conn());
+ assert(conn().getRaw() != NULL);
conn()->auth_user_request = NULL;
conn()->auth_type = AUTH_BROKEN;
auth_user_request = NULL;
request = NULL;
- cbdataReferenceDone(conn_);
+ conn_ = NULL;
cbdataReferenceDone(accessList);
}
-ConnStateData *
+ConnStateData::Pointer
ACLChecklist::conn()
{
return conn_;
}
void
-ACLChecklist::conn(ConnStateData *aConn)
+ACLChecklist::conn(ConnStateData::Pointer aConn)
{
- assert (conn() == NULL);
+ assert (conn().getRaw() == NULL);
conn_ = aConn;
}
/*
- * $Id: ACLChecklist.h,v 1.12 2003/07/06 21:50:55 hno Exp $
+ * $Id: ACLChecklist.h,v 1.13 2003/07/11 01:40:34 robertc Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
#define SQUID_ACLCHECKLIST_H
#include "typedefs.h"
+#include "client_side.h"
class ExternalACLEntry;
void checkCallback(allow_t answer);
bool _SQUID_INLINE_ matchAclListFast(const acl_list * list);
void _SQUID_INLINE_ matchAclListSlow(const acl_list * list);
- ConnStateData *conn();
- void conn(ConnStateData *);
+ ConnStateData::Pointer conn();
+ void conn(ConnStateData::Pointer);
int authenticated();
bool asyncInProgress() const;
private:
void matchAclList(const acl_list * list, bool const fast);
CBDATA_CLASS(ACLChecklist);
- ConnStateData *conn_; /* hack for ident and NTLM */
+ ConnStateData::Pointer conn_; /* hack for ident and NTLM */
bool async_;
bool finished_;
allow_t allow_;
/*
- * $Id: ACLDestinationDomain.cc,v 1.3 2003/02/21 22:50:04 robertc Exp $
+ * $Id: ACLDestinationDomain.cc,v 1.4 2003/07/11 01:40:34 robertc Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
#include "ACLChecklist.h"
#include "ACLRegexData.h"
#include "ACLDomainData.h"
+#include "HttpRequest.h"
MemPool *ACLDestinationDomain::Pool(NULL);
void *
#include "squid.h"
#include "ACLDestinationIP.h"
#include "ACLChecklist.h"
+#include "HttpRequest.h"
MemPool *ACLDestinationIP::Pool(NULL);
void *
/*
- * $Id: ACLExtUser.cc,v 1.1 2003/06/27 22:32:31 hno Exp $
+ * $Id: ACLExtUser.cc,v 1.2 2003/07/11 01:40:34 robertc Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
#include "ACLRegexData.h"
#include "ACLUserData.h"
#include "client_side.h"
+#include "HttpRequest.h"
MemPool *ACLExtUser::Pool(NULL);
void *
checklist->asyncInProgress(true);
debug(28, 3) ("IdentLookup::checkForAsync: Doing ident lookup\n");
- if (checklist->conn() && cbdataReferenceValid(checklist->conn())) {
+ if (checklist->conn().getRaw() != NULL) {
identStart(&checklist->conn()->me, &checklist->conn()->peer,
LookupDone, checklist);
} else {
* Cache the ident result in the connection, to avoid redoing ident lookup
* over and over on persistent connections
*/
- if (cbdataReferenceValid(checklist->conn()) && !checklist->conn()->rfc931[0])
+ if (checklist->conn().getRaw() != NULL && !checklist->conn()->rfc931[0])
xstrncpy(checklist->conn()->rfc931, checklist->rfc931, USER_IDENT_SZ);
checklist->asyncInProgress(false);
/*
- * $Id: ACLMethod.cc,v 1.1 2003/02/25 12:16:55 robertc Exp $
+ * $Id: ACLMethod.cc,v 1.2 2003/07/11 01:40:34 robertc Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
#include "ACLMethod.h"
#include "ACLMethodData.h"
#include "ACLChecklist.h"
+#include "HttpRequest.h"
ACL::Prototype ACLMethod::RegistryProtoype(&ACLMethod::RegistryEntry_, "method");
ACLStrategised<method_t> ACLMethod::RegistryEntry_(new ACLMethodData, ACLMethodStrategy::Instance(), "method");
/*
- * $Id: ACLProtocol.cc,v 1.1 2003/02/25 12:16:55 robertc Exp $
+ * $Id: ACLProtocol.cc,v 1.2 2003/07/11 01:40:34 robertc Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
#include "ACLProtocol.h"
#include "ACLProtocolData.h"
#include "ACLChecklist.h"
+#include "HttpRequest.h"
ACL::Prototype ACLProtocol::RegistryProtoype(&ACLProtocol::RegistryEntry_, "proto");
ACLStrategised<protocol_t> ACLProtocol::RegistryEntry_(new ACLProtocolData, ACLProtocolStrategy::Instance(), "proto");
#include "ACLUserData.h"
#include "ACLRegexData.h"
#include "client_side.h"
+#include "HttpRequest.h"
MemPool *ACLProxyAuth::Pool(NULL);
void *
/* OR the connection was closed, there's no way to continue */
authenticateAuthUserRequestUnlock(checklist->auth_user_request);
- if (checklist->conn()) {
+ if (checklist->conn().getRaw() != NULL) {
checklist->conn()->auth_user_request = NULL;
checklist->conn()->auth_type = AUTH_BROKEN;
}
/*
- * $Id: ACLReplyMIMEType.h,v 1.1 2003/02/25 12:22:34 robertc Exp $
+ * $Id: ACLReplyMIMEType.h,v 1.2 2003/07/11 01:40:34 robertc Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
#include "ACLReplyHeaderStrategy.h"
#include "ACLStrategised.h"
#include "ACLChecklist.h"
+#include "HttpRequest.h"
class ACLReplyMIMEType
{
/*
- * $Id: ACLRequestHeaderStrategy.h,v 1.4 2003/06/19 13:12:01 robertc Exp $
+ * $Id: ACLRequestHeaderStrategy.h,v 1.5 2003/07/11 01:40:33 robertc Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
#include "ACL.h"
#include "ACLData.h"
#include "ACLStrategy.h"
+#include "HttpRequest.h"
template <http_hdr_type header>
/*
- * $Id: ACLUrlPath.cc,v 1.1 2003/02/17 07:01:35 robertc Exp $
+ * $Id: ACLUrlPath.cc,v 1.2 2003/07/11 01:40:34 robertc Exp $
*
* DEBUG: section 28 Access Control
* AUTHOR: Duane Wessels
#include "ACLUrlPath.h"
#include "ACLChecklist.h"
#include "ACLRegexData.h"
+#include "HttpRequest.h"
ACL::Prototype ACLUrlPath::LegacyRegistryProtoype(&ACLUrlPath::RegistryEntry_, "pattern");
ACL::Prototype ACLUrlPath::RegistryProtoype(&ACLUrlPath::RegistryEntry_, "urlpath_regex");
/*
- * $Id: ACLUrlPort.cc,v 1.1 2003/02/25 12:16:55 robertc Exp $
+ * $Id: ACLUrlPort.cc,v 1.2 2003/07/11 01:40:34 robertc Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
#include "ACLUrlPort.h"
#include "ACLIntRange.h"
#include "ACLChecklist.h"
+#include "HttpRequest.h"
ACL::Prototype ACLUrlPort::RegistryProtoype(&ACLUrlPort::RegistryEntry_, "port");
ACLStrategised<int> ACLUrlPort::RegistryEntry_(new ACLIntRange, ACLUrlPortStrategy::Instance(), "port");
/*
- * $Id: DelayId.cc,v 1.11 2003/07/10 11:04:06 robertc Exp $
+ * $Id: DelayId.cc,v 1.12 2003/07/11 01:40:34 robertc Exp $
*
* DEBUG: section 77 Delay Pools
* AUTHOR: Robert Collins <robertc@squid-cache.org>
ch.my_addr = r->my_addr;
ch.my_port = r->my_port;
- if (http->getConn())
- ch.conn(cbdataReference(http->getConn()));
+ if (http->getConn().getRaw() != NULL)
+ ch.conn(http->getConn());
ch.request = requestLink(r);
/*
- * $Id: HttpRequest.cc,v 1.38 2003/07/09 14:14:57 hno Exp $
+ * $Id: HttpRequest.cc,v 1.39 2003/07/11 01:40:34 robertc Exp $
*
* DEBUG: section 73 HTTP Request
* AUTHOR: Duane Wessels
{
assert(req);
- if (req->body_connection)
+ if (req->body_connection.getRaw() != NULL)
clientAbortBody(req);
if (req->auth_user_request)
/*
- * $Id: HttpRequest.h,v 1.1 2003/01/23 00:37:13 robertc Exp $
+ * $Id: HttpRequest.h,v 1.2 2003/07/11 01:40:35 robertc Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
#define SQUID_HTTPREQUEST_H
#include "typedefs.h"
+#include "client_side.h"
+
+class request_t
+{
+
+public:
+ bool multipartRangeRequest() const;
+
+ method_t method;
+ protocol_t protocol;
+ char login[MAX_LOGIN_SZ];
+ char host[SQUIDHOSTNAMELEN + 1];
+ auth_user_request_t *auth_user_request;
+ u_short port;
+ String urlpath;
+ char *canonical;
+ int link_count; /* free when zero */
+ request_flags flags;
+ HttpHdrCc *cache_control;
+ HttpHdrRange *range;
+ http_version_t http_ver;
+ time_t ims;
+ int imslen;
+ int max_forwards;
+ /* these in_addr's could probably be sockaddr_in's */
+
+ struct in_addr client_addr;
+
+ struct in_addr my_addr;
+ unsigned short my_port;
+ unsigned short client_port;
+ HttpHeader header;
+ ConnStateData::Pointer body_connection; /* used by clientReadBody() */
+ int content_length;
+ HierarchyLogEntry hier;
+ err_type errType;
+ char *peer_login; /* Configured peer login:password */
+ time_t lastmod; /* Used on refreshes */
+ const char *vary_headers; /* Used when varying entities are detected. Changes how the store key is calculated */
+ char *peer_domain; /* Configured peer forceddomain */
+ String tag; /* Internal tag for this request */
+ String extacl_user; /* User name returned by extacl lookup */
+ String extacl_passwd; /* Password returned by extacl lookup */
+ String extacl_log; /* String to be used for access.log purposes */
+};
/* Http Request */
extern request_t *requestCreate(method_t, protocol_t, const char *urlpath);
extern int httpRequestHdrAllowed(const HttpHeaderEntry * e, String * strConnection);
extern int httpRequestHdrAllowedByName(http_hdr_type id);
+
#endif /* SQUID_HTTPREQUEST_H */
/*
- * $Id: auth_basic.cc,v 1.25 2003/05/29 15:54:09 hno Exp $
+ * $Id: auth_basic.cc,v 1.26 2003/07/11 01:40:39 robertc Exp $
*
* DEBUG: section 29 Authenticator
* AUTHOR: Duane Wessels
/* log a basic user in
*/
static void
-authenticateBasicAuthenticateUser(auth_user_request_t * auth_user_request, request_t * request, ConnStateData * conn, http_hdr_type type)
+authenticateBasicAuthenticateUser(auth_user_request_t * auth_user_request, request_t * request, ConnStateData::Pointer conn, http_hdr_type type)
{
auth_user_t *auth_user;
basic_data *basic_auth;
/*
- * $Id: auth_digest.cc,v 1.24 2003/06/19 19:56:11 hno Exp $
+ * $Id: auth_digest.cc,v 1.25 2003/07/11 01:40:41 robertc Exp $
*
* DEBUG: section 29 Authenticator
* AUTHOR: Robert Collins
#include "auth_digest.h"
#include "authenticate.h"
#include "Store.h"
+#include "HttpRequest.h"
extern AUTHSSETUP authSchemeSetup_digest;
/* log a digest user in
*/
void
-digest_request_h::authenticate(request_t * request, ConnStateData * conn, http_hdr_type type)
+digest_request_h::authenticate(request_t * request, ConnStateData::Pointer conn, http_hdr_type type)
{
auth_user_t *auth_user;
digest_request_h *digest_request;
~digest_request_h();
int authenticated() const;
- virtual void authenticate(request_t * request, ConnStateData * conn, http_hdr_type type);
+ virtual void authenticate(request_t * request, ConnStateData::Pointer conn, http_hdr_type type);
virtual int direction();
virtual void addHeader(HttpReply * rep, int accel);
/*
- * $Id: auth_ntlm.cc,v 1.31 2003/03/04 01:40:55 robertc Exp $
+ * $Id: auth_ntlm.cc,v 1.32 2003/07/11 01:40:42 robertc Exp $
*
* DEBUG: section 29 NTLM Authenticator
* AUTHOR: Robert Collins
#include "authenticate.h"
#include "Store.h"
#include "client_side.h"
+#include "HttpRequest.h"
extern AUTHSSETUP authSchemeSetup_ntlm;
}
void
-ntlm_request_t::authenticate(request_t * request, ConnStateData * conn, http_hdr_type type)
+ntlm_request_t::authenticate(request_t * request, ConnStateData::Pointer conn, http_hdr_type type)
{
fatal ("unusable");
}
static void
-authenticateNTLMAuthenticateUser(auth_user_request_t * auth_user_request, request_t * request, ConnStateData * conn, http_hdr_type type)
+authenticateNTLMAuthenticateUser(auth_user_request_t * auth_user_request, request_t * request, ConnStateData::Pointer conn, http_hdr_type type)
{
const char *proxy_auth;
/* Check that we are in the client side, where we can generate
* auth challenges */
- if (!conn) {
+ if (conn.getRaw() == NULL) {
ntlm_request->auth_state = AUTHENTICATE_STATE_FAILED;
debug(29, 1) ("authenticateNTLMAuthenticateUser: attempt to perform authentication without a connection!\n");
return;
~ntlm_request_t();
virtual int authenticated() const;
- virtual void authenticate(request_t * request, ConnStateData * conn, http_hdr_type type);
+ virtual void authenticate(request_t * request, ConnStateData::Pointer conn, http_hdr_type type);
virtual int direction();
/* what negotiate string did the client use? */
char *ntlmnegotiate;
/* have we got the helper-server in a deferred state? */
int authserver_deferred;
/* what connection is this associated with */
- ConnStateData *conn;
+ ConnStateData::Pointer conn;
private:
static MemPool *Pool;
/*
- * $Id: authenticate.cc,v 1.58 2003/06/19 18:56:59 hno Exp $
+ * $Id: authenticate.cc,v 1.59 2003/07/11 01:40:35 robertc Exp $
*
* DEBUG: section 29 Authenticator
* AUTHOR: Robert Collins
#include "authenticate.h"
#include "ACL.h"
#include "client_side.h"
+#include "HttpRequest.h"
CBDATA_TYPE(auth_user_ip_t);
* This is basically a handle approach.
*/
static void
-authenticateAuthenticateUser(auth_user_request_t * auth_user_request, request_t * request, ConnStateData * conn, http_hdr_type type)
+authenticateAuthenticateUser(auth_user_request_t * auth_user_request, request_t * request, ConnStateData::Pointer &conn, http_hdr_type type)
{
assert(auth_user_request != NULL);
}
static auth_user_request_t *
-authTryGetUser (auth_user_request_t **auth_user_request, ConnStateData * conn)
+authTryGetUser (auth_user_request_t **auth_user_request, ConnStateData::Pointer & conn)
{
if (*auth_user_request)
return *auth_user_request;
- else if (conn)
+ else if (conn.getRaw() != NULL)
return conn->auth_user_request;
else
return NULL;
*/
auth_acl_t
-AuthUserRequest::authenticate(auth_user_request_t ** auth_user_request, http_hdr_type headertype, request_t * request, ConnStateData * conn, struct in_addr src_addr)
+AuthUserRequest::authenticate(auth_user_request_t ** auth_user_request, http_hdr_type headertype, request_t * request, ConnStateData::Pointer conn, struct in_addr src_addr)
{
const char *proxy_auth;
assert(headertype != 0);
*/
if (((proxy_auth == NULL) && (!authenticateUserAuthenticated(authTryGetUser(auth_user_request,conn))))
- || (conn && conn->auth_type == AUTH_BROKEN))
+ || (conn.getRaw() != NULL && conn->auth_type == AUTH_BROKEN))
{
/* no header or authentication failed/got corrupted - restart */
debug(28, 4) ("authenticateAuthenticate: broken auth or no proxy_auth header. Requesting auth header.\n");
/* something wrong with the AUTH credentials. Force a new attempt */
- if (conn) {
+ if (conn.getRaw() != NULL) {
conn->auth_type = AUTH_UNKNOWN;
if (conn->auth_user_request)
* No check for function required in the if: its compulsory for conn based
* auth modules
*/
- if (proxy_auth && conn && conn->auth_user_request &&
+ if (proxy_auth && conn.getRaw() != NULL && conn->auth_user_request &&
authenticateUserAuthenticated(conn->auth_user_request) &&
strcmp(proxy_auth, authscheme_list[conn->auth_user_request->auth_user->auth_module - 1].authConnLastHeader(conn->auth_user_request)))
{
if (*auth_user_request == NULL)
{
debug(28, 9) ("authenticateAuthenticate: This is a new checklist test on FD:%d\n",
- conn ? conn->fd : -1);
+ conn.getRaw() != NULL ? conn->fd : -1);
if ((!request->auth_user_request)
- && (!conn || conn->auth_type == AUTH_UNKNOWN)) {
+ && (conn.getRaw() == NULL || conn->auth_type == AUTH_UNKNOWN)) {
/* beginning of a new request check */
debug(28, 4) ("authenticateAuthenticate: no connection authentication type\n");
;
} else {
- assert (conn);
+ assert (conn.getRaw() != NULL);
if (conn->auth_user_request != NULL) {
*auth_user_request = conn->auth_user_request;
auth_acl_t
-AuthUserRequest::tryToAuthenticateAndSetAuthUser(auth_user_request_t ** auth_user_request, http_hdr_type headertype, request_t * request, ConnStateData * conn, struct in_addr src_addr)
+AuthUserRequest::tryToAuthenticateAndSetAuthUser(auth_user_request_t ** auth_user_request, http_hdr_type headertype, request_t * request, ConnStateData::Pointer conn, struct in_addr src_addr)
{
/* If we have already been called, return the cached value */
auth_user_request_t *t = authTryGetUser (auth_user_request, conn);
auth_acl_t
-authenticateTryToAuthenticateAndSetAuthUser(auth_user_request_t ** auth_user_request, http_hdr_type headertype, request_t * request, ConnStateData * conn, struct in_addr src_addr)
+authenticateTryToAuthenticateAndSetAuthUser(auth_user_request_t ** auth_user_request, http_hdr_type headertype, request_t * request, ConnStateData::Pointer conn, struct in_addr src_addr)
{
return AuthUserRequest::tryToAuthenticateAndSetAuthUser (auth_user_request, headertype,request, conn, src_addr);
}
/*
- * $Id: authenticate.h,v 1.8 2003/02/26 06:11:40 robertc Exp $
+ * $Id: authenticate.h,v 1.9 2003/07/11 01:40:36 robertc Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
#ifndef SQUID_AUTHENTICATE_H
#define SQUID_AUTHENTICATE_H
+#include "client_side.h"
+
class AuthUser;
struct AuthUserHashPointer : public hash_link
virtual ~AuthUserRequestState(){}
virtual int authenticated() const = 0;
- virtual void authenticate(request_t * request, ConnStateData * conn, http_hdr_type type) = 0;
+ virtual void authenticate(request_t * request, ConnStateData::Pointer conn, http_hdr_type type) = 0;
virtual int direction() = 0;
virtual void addHeader(HttpReply * rep, int accel) {}}
public:
- static auth_acl_t tryToAuthenticateAndSetAuthUser(auth_user_request_t **, http_hdr_type, request_t *, ConnStateData *, struct in_addr);
+ static auth_acl_t tryToAuthenticateAndSetAuthUser(auth_user_request_t **, http_hdr_type, request_t *, ConnStateData::Pointer, struct in_addr);
static void addReplyAuthHeader(HttpReply * rep, auth_user_request_t * auth_user_request, request_t * request, int accelerated, int internal);
~AuthUserRequest();
private:
- static auth_acl_t authenticate(auth_user_request_t ** auth_user_request, http_hdr_type headertype, request_t * request, ConnStateData * conn, struct in_addr src_addr);
+ static auth_acl_t authenticate(auth_user_request_t ** auth_user_request, http_hdr_type headertype, request_t * request, ConnStateData::Pointer conn, struct in_addr src_addr);
static auth_user_request_t *createAuthUser (const char *proxy_auth);
/* authenticate.c authenticate scheme routines typedefs */
typedef int AUTHSACTIVE(void);
typedef int AUTHSAUTHED(auth_user_request_t *);
-typedef void AUTHSAUTHUSER(auth_user_request_t *, request_t *, ConnStateData *, http_hdr_type);
+typedef void AUTHSAUTHUSER(auth_user_request_t *, request_t *, ConnStateData::Pointer, http_hdr_type);
typedef int AUTHSCONFIGURED(void);
typedef void AUTHSDECODE(auth_user_request_t *, const char *);
typedef int AUTHSDIRECTION(auth_user_request_t *);
typedef void AUTHSSTATS(StoreEntry *);
typedef const char *AUTHSCONNLASTHEADER(auth_user_request_t *);
-extern "C"
-{
- /* subsumed by the C++ interface */
- extern void authenticateAuthUserMerge(auth_user_t *, auth_user_t *);
- extern auth_user_t *authenticateAuthUserNew(const char *);
-
- /* AuthUserRequest */
- extern void authenticateStart(auth_user_request_t *, RH *, void *);
-
- extern auth_acl_t authenticateTryToAuthenticateAndSetAuthUser(auth_user_request_t **, http_hdr_type, request_t *, ConnStateData *, struct in_addr);
- extern void authenticateSetDenyMessage (auth_user_request_t *, char const *);
- extern size_t authenticateRequestRefCount (auth_user_request_t *);
- extern char const *authenticateAuthUserRequestMessage(auth_user_request_t *);
-
- extern int authenticateAuthSchemeId(const char *typestr);
- extern void authenticateSchemeInit(void);
- extern void authenticateInit(authConfig *);
- extern void authenticateShutdown(void);
- extern void authenticateFixHeader(HttpReply *, auth_user_request_t *, request_t *, int, int);
- extern void authenticateAddTrailer(HttpReply *, auth_user_request_t *, request_t *, int);
- extern void authenticateAuthUserUnlock(auth_user_t * auth_user);
- extern void authenticateAuthUserLock(auth_user_t * auth_user);
- extern void authenticateAuthUserRequestUnlock(auth_user_request_t *);
- extern void authenticateAuthUserRequestLock(auth_user_request_t *);
- extern int authenticateAuthUserInuse(auth_user_t * auth_user);
-
- extern void authenticateAuthUserRequestRemoveIp(auth_user_request_t *, struct in_addr);
- extern void authenticateAuthUserRequestClearIp(auth_user_request_t *);
- extern size_t authenticateAuthUserRequestIPCount(auth_user_request_t *);
- extern int authenticateDirection(auth_user_request_t *);
- extern void authenticateFreeProxyAuthUserACLResults(void *data);
- extern int authenticateActiveSchemeCount(void);
- extern int authenticateSchemeCount(void);
- extern void authenticateUserNameCacheAdd(auth_user_t * auth_user);
-
- extern int authenticateCheckAuthUserIP(struct in_addr request_src_addr, auth_user_request_t * auth_user);
- extern int authenticateUserAuthenticated(auth_user_request_t *);
- extern void authenticateUserCacheRestart(void);
- extern char const *authenticateUserRequestUsername(auth_user_request_t *);
- extern int authenticateValidateUser(auth_user_request_t *);
- extern void authenticateOnCloseConnection(ConnStateData * conn);
- extern void authSchemeAdd(const char *type, AUTHSSETUP * setup);
-
- /* AuthUserHashPointer */
- extern auth_user_t* authUserHashPointerUser(auth_user_hash_pointer *);
-
-}
+/* subsumed by the C++ interface */
+extern void authenticateAuthUserMerge(auth_user_t *, auth_user_t *);
+extern auth_user_t *authenticateAuthUserNew(const char *);
+
+/* AuthUserRequest */
+extern void authenticateStart(auth_user_request_t *, RH *, void *);
+
+extern auth_acl_t authenticateTryToAuthenticateAndSetAuthUser(auth_user_request_t **, http_hdr_type, request_t *, ConnStateData::Pointer, struct in_addr);
+extern void authenticateSetDenyMessage (auth_user_request_t *, char const *);
+extern size_t authenticateRequestRefCount (auth_user_request_t *);
+extern char const *authenticateAuthUserRequestMessage(auth_user_request_t *);
+
+extern int authenticateAuthSchemeId(const char *typestr);
+extern void authenticateSchemeInit(void);
+extern void authenticateInit(authConfig *);
+extern void authenticateShutdown(void);
+extern void authenticateFixHeader(HttpReply *, auth_user_request_t *, request_t *, int, int);
+extern void authenticateAddTrailer(HttpReply *, auth_user_request_t *, request_t *, int);
+extern void authenticateAuthUserUnlock(auth_user_t * auth_user);
+extern void authenticateAuthUserLock(auth_user_t * auth_user);
+extern void authenticateAuthUserRequestUnlock(auth_user_request_t *);
+extern void authenticateAuthUserRequestLock(auth_user_request_t *);
+extern int authenticateAuthUserInuse(auth_user_t * auth_user);
+
+extern void authenticateAuthUserRequestRemoveIp(auth_user_request_t *, struct in_addr);
+extern void authenticateAuthUserRequestClearIp(auth_user_request_t *);
+extern size_t authenticateAuthUserRequestIPCount(auth_user_request_t *);
+extern int authenticateDirection(auth_user_request_t *);
+extern void authenticateFreeProxyAuthUserACLResults(void *data);
+extern int authenticateActiveSchemeCount(void);
+extern int authenticateSchemeCount(void);
+extern void authenticateUserNameCacheAdd(auth_user_t * auth_user);
+
+extern int authenticateCheckAuthUserIP(struct in_addr request_src_addr, auth_user_request_t * auth_user);
+extern int authenticateUserAuthenticated(auth_user_request_t *);
+extern void authenticateUserCacheRestart(void);
+extern char const *authenticateUserRequestUsername(auth_user_request_t *);
+extern int authenticateValidateUser(auth_user_request_t *);
+extern void authenticateOnCloseConnection(ConnStateData * conn);
+extern void authSchemeAdd(const char *type, AUTHSSETUP * setup);
+
+/* AuthUserHashPointer */
+extern auth_user_t* authUserHashPointerUser(auth_user_hash_pointer *);
/* auth_modules.c */
SQUIDCEXTERN void authSchemeSetup(void);
/*
- * $Id: client_side.cc,v 1.647 2003/07/10 11:04:06 robertc Exp $
+ * $Id: client_side.cc,v 1.648 2003/07/11 01:40:36 robertc Exp $
*
* DEBUG: section 33 Client-side Routines
* AUTHOR: Duane Wessels
static PF connStateFree;
static PF requestTimeout;
static PF clientLifetimeTimeout;
-static ClientSocketContext *parseHttpRequestAbort(ConnStateData * conn,
+static ClientSocketContext *parseHttpRequestAbort(ConnStateData::Pointer & conn,
const char *uri);
-static ClientSocketContext *parseHttpRequest(ConnStateData *, method_t *,
+static ClientSocketContext *parseHttpRequest(ConnStateData::Pointer &, method_t *,
char **, size_t *);
#if USE_IDENT
static IDCB clientIdentDone;
{
public:
- ClientBody (ConnStateData *);
+ ClientBody (ConnStateData::Pointer &);
void process();
void preProcessing();
void processBuffer();
private:
- ConnStateData *conn;
+ ConnStateData::Pointer conn;
char *buf;
CBCB *callback;
request_t *request;
static void clientUpdateHierCounters(HierarchyLogEntry *);
static bool clientPingHasFinished(ping_data const *aPing);
static void clientPrepareLogWithRequestDetails(request_t *, AccessLogEntry *);
-static int connIsUsable(ConnStateData * conn);
+static int connIsUsable(ConnStateData::Pointer conn);
static int responseFinishedOrFailed(HttpReply * rep, StoreIOBuffer const &recievedData);
-static void ClientSocketContextPushDeferredIfNeeded(ClientSocketContext::Pointer deferredRequest, ConnStateData * conn);
+static void ClientSocketContextPushDeferredIfNeeded(ClientSocketContext::Pointer deferredRequest, ConnStateData::Pointer & conn);
static void clientUpdateSocketStats(log_type logType, size_t size);
-static ClientSocketContext *clientParseRequestMethod(char *inbuf, method_t * method_p, ConnStateData * conn);
+static ClientSocketContext *clientParseRequestMethod(char *inbuf, method_t * method_p, ConnStateData::Pointer & conn);
static char *skipLeadingSpace(char *aString);
static char *findTrailingHTTPVersion(char *uriAndHTTPVersion);
#if UNUSED_CODE
static void trimTrailingSpaces(char *aString, size_t len);
#endif
-static ClientSocketContext *parseURIandHTTPVersion(char **url_p, http_version_t * http_ver_p, ConnStateData * conn, char *http_version_str);
+static ClientSocketContext *parseURIandHTTPVersion(char **url_p, http_version_t * http_ver_p, ConnStateData::Pointer& conn, char *http_version_str);
static void setLogUri(clientHttpRequest * http, char const *uri);
-static int connReadWasError(ConnStateData * conn, comm_err_t, int size, int xerrno);
-static int connFinishedWithConn(ConnStateData * conn, int size);
-static void connNoteUseOfBuffer(ConnStateData * conn, size_t byteCount);
-static int connKeepReadingIncompleteRequest(ConnStateData * conn);
-static void connCancelIncompleteRequests(ConnStateData * conn);
+static int connReadWasError(ConnStateData::Pointer& conn, comm_err_t, int size, int xerrno);
+static int connFinishedWithConn(ConnStateData::Pointer& conn, int size);
+static void connNoteUseOfBuffer(ConnStateData::Pointer & conn, size_t byteCount);
+static int connKeepReadingIncompleteRequest(ConnStateData::Pointer & conn);
+static void connCancelIncompleteRequests(ConnStateData::Pointer & conn);
static ConnStateData *connStateCreate(struct sockaddr_in *peer, struct sockaddr_in *me, int fd, http_port_list *port);
ClientSocketContext::fd() const
{
assert (http);
- assert (http->getConn());
+ assert (http->getConn().getRaw() != NULL);
return http->getConn()->fd;
}
void
-ClientSocketContext::removeFromConnectionList(ConnStateData * conn)
+ClientSocketContext::removeFromConnectionList(ConnStateData::Pointer conn)
{
ClientSocketContext::Pointer *tempContextPointer;
- assert(conn);
+ assert(conn.getRaw() != NULL);
assert(conn->getCurrentContext().getRaw() != NULL);
/* Unlink us from the connection request list */
tempContextPointer = & conn->currentobject;
{
assert (!connRegistered_);
assert (http);
- assert (http->getConn());
+ assert (http->getConn().getRaw() != NULL);
connRegistered_ = true;
http->getConn()->addContextToQueue(this);
}
ClientSocketContext::connIsFinished()
{
assert (http);
- assert (http->getConn());
+ assert (http->getConn().getRaw() != NULL);
deRegisterWithConn();
/* we can't handle any more stream data - detach */
clientStreamDetach(getTail(), http);
al.http.content_type = memObject()->getReply()->content_type.buf();
}
- al.cache.caddr = getConn() ? getConn()->log_addr : no_addr;
+ al.cache.caddr = getConn().getRaw() != NULL ? getConn()->log_addr : no_addr;
al.cache.size = out.size;
al.cache.code = logType;
al.cache.msec = tvSubMsec(start, current_time);
if (request)
clientPrepareLogWithRequestDetails(request, &al);
- if (getConn() && getConn()->rfc931[0])
+ if (getConn().getRaw() != NULL && getConn()->rfc931[0])
al.cache.rfc931 = getConn()->rfc931;
#if USE_SSL
accessLogLog(&al, checklist);
updateCounters();
- if (getConn())
+ if (getConn().getRaw() != NULL)
clientdbUpdate(getConn()->peer.sin_addr, logType, PROTO_HTTP, out.size);
}
{
ConnStateData *connState = (ConnStateData *)data;
assert (fd == connState->fd);
- connState->deleteSelf();
+ connState->close();
}
-ConnStateData::~ConnStateData()
+void
+ConnStateData::close()
{
- debug(33, 3) ("ConnStateData::~ConnStateData: FD %d\n", fd);
- assert(this != NULL);
+ debug(33, 3) ("ConnStateData::close: FD %d\n", fd);
+ open_ = false;
clientdbEstablished(peer.sin_addr, -1); /* decrement */
assert(areAllContextsForThisConnection());
freeAllContexts();
+ authenticateOnCloseConnection(this);
+}
+
+bool
+ConnStateData::isOpen() const
+{
+ return open_;
+}
+
+ConnStateData::~ConnStateData()
+{
+ assert(this != NULL);
+ debug(33, 3) ("ConnStateData::~ConnStateData: FD %d\n", fd);
+
+ if (isOpen())
+ close();
if (auth_user_request)
authenticateAuthUserRequestUnlock(auth_user_request);
auth_user_request = NULL;
- authenticateOnCloseConnection(this);
-
pconnHistCount(0, nrequests);
cbdataReferenceDone(port);
}
int
-connIsUsable(ConnStateData * conn)
+connIsUsable(ConnStateData::Pointer conn)
{
- if (!conn || conn->fd == -1)
+ if (conn.getRaw() == NULL || conn->fd == -1)
return 0;
return 1;
}
void
-ClientSocketContextPushDeferredIfNeeded(ClientSocketContext::Pointer deferredRequest, ConnStateData * conn)
+ClientSocketContextPushDeferredIfNeeded(ClientSocketContext::Pointer deferredRequest, ConnStateData::Pointer & conn)
{
debug(33, 2) ("ClientSocketContextPushDeferredIfNeeded: FD %d Sending next\n",
conn->fd);
void
ClientSocketContext::keepaliveNextRequest()
{
- ConnStateData *conn = http->getConn();
+ ConnStateData::Pointer conn = http->getConn();
debug(33, 3) ("ClientSocketContext::keepaliveNextRequest: FD %d\n", conn->fd);
connIsFinished();
extern "C" CSD clientReplyDetach;
static ClientSocketContext *
-parseHttpRequestAbort(ConnStateData * conn, const char *uri)
+parseHttpRequestAbort(ConnStateData::Pointer & conn, const char *uri)
{
clientHttpRequest *http;
ClientSocketContext *context;
}
ClientSocketContext *
-clientParseRequestMethod(char *inbuf, method_t * method_p, ConnStateData * conn)
+clientParseRequestMethod(char *inbuf, method_t * method_p, ConnStateData::Pointer & conn)
{
char *mstr = NULL;
static ClientSocketContext *
parseURIandHTTPVersion(char **url_p, http_version_t * http_ver_p,
- ConnStateData * conn, char *http_version_str)
+ ConnStateData::Pointer & conn, char *http_version_str)
{
char *url;
char *t;
/* Utility function to perform part of request parsing */
static ClientSocketContext *
-clientParseHttpRequestLine(char *reqline, ConnStateData * conn,
+clientParseHttpRequestLine(char *reqline, ConnStateData::Pointer &conn,
method_t * method_p, char **url_p, http_version_t * http_ver_p, char * http_version_str)
{
ClientSocketContext *result = NULL;
}
static void
-prepareAcceleratedURL(ConnStateData * conn, clientHttpRequest *http, char *url, const char *req_hdr)
+prepareAcceleratedURL(ConnStateData::Pointer & conn, clientHttpRequest *http, char *url, const char *req_hdr)
{
int vhost = conn->port->vhost;
int vport = conn->port->vport;
}
static void
-prepareTransparentURL(ConnStateData * conn, clientHttpRequest *http, char *url, const char *req_hdr)
+prepareTransparentURL(ConnStateData::Pointer & conn, clientHttpRequest *http, char *url, const char *req_hdr)
{
char *host;
* Sets result->flags.parsed_ok to 1 if we have a good request.
*/
static ClientSocketContext *
-parseHttpRequest(ConnStateData * conn, method_t * method_p,
+parseHttpRequest(ConnStateData::Pointer & conn, method_t * method_p,
char **prefix_p, size_t * req_line_sz_p)
{
char *inbuf = NULL;
}
int
-connReadWasError(ConnStateData * conn, comm_err_t flag, int size, int xerrno)
+connReadWasError(ConnStateData::Pointer & conn, comm_err_t flag, int size, int xerrno)
{
if (flag != COMM_OK) {
debug(50, 2) ("connReadWasError: FD %d: got flag %d\n", conn->fd, flag);
}
int
-connFinishedWithConn(ConnStateData * conn, int size)
+connFinishedWithConn(ConnStateData::Pointer & conn, int size)
{
if (size == 0) {
if (conn->getConcurrentRequestCount() == 0 && conn->in.notYetUsed == 0) {
}
void
-connNoteUseOfBuffer(ConnStateData * conn, size_t byteCount)
+connNoteUseOfBuffer(ConnStateData::Pointer & conn, size_t byteCount)
{
assert(byteCount > 0 && byteCount <= conn->in.notYetUsed);
conn->in.notYetUsed -= byteCount;
}
int
-connKeepReadingIncompleteRequest(ConnStateData * conn)
+connKeepReadingIncompleteRequest(ConnStateData::Pointer & conn)
{
return conn->in.notYetUsed >= Config.maxRequestHeaderSize ? 0 : 1;
}
void
-connCancelIncompleteRequests(ConnStateData * conn)
+connCancelIncompleteRequests(ConnStateData::Pointer & conn)
{
ClientSocketContext *context = parseHttpRequestAbort(conn, "error:request-too-large");
clientStreamNode *node = context->getClientReplyContext();
}
static void
-clientMaybeReadData(ConnStateData *conn, int do_next_read)
+clientMaybeReadData(ConnStateData::Pointer &conn, int do_next_read)
{
if (do_next_read) {
conn->flags.readMoreRequests = 1;
}
static void
-clientAfterReadingRequests(int fd, ConnStateData *conn, int do_next_read)
+clientAfterReadingRequests(int fd, ConnStateData::Pointer &conn, int do_next_read)
{
fde *F = &fd_table[fd];
}
static void
-clientProcessRequest(ConnStateData *conn, ClientSocketContext *context, method_t method, char *prefix, size_t req_line_sz)
+clientProcessRequest(ConnStateData::Pointer &conn, ClientSocketContext *context, method_t method, char *prefix, size_t req_line_sz)
{
clientHttpRequest *http = context->http;
request_t *request = NULL;
}
static void
-connStripBufferWhitespace (ConnStateData *conn)
+connStripBufferWhitespace (ConnStateData::Pointer &conn)
{
while (conn->in.notYetUsed > 0 && xisspace(conn->in.buf[0])) {
xmemmove(conn->in.buf, conn->in.buf + 1, conn->in.notYetUsed - 1);
}
static int
-connOkToAddRequest(ConnStateData *conn)
+connOkToAddRequest(ConnStateData::Pointer &conn)
{
int result = conn->getConcurrentRequestCount() < (Config.onoff.pipeline_prefetch ? 2 : 1);
clientReadRequest(int fd, char *buf, size_t size, comm_err_t flag, int xerrno,
void *data)
{
- ConnStateData *conn = (ConnStateData *)data;
+ ConnStateData::Pointer conn ((ConnStateData *)data);
conn->reading(false);
method_t method;
char *prefix = NULL;
clientReadBody(request_t * request, char *buf, size_t size, CBCB * callback,
void *cbdata)
{
- ConnStateData *conn = request->body_connection;
+ ConnStateData::Pointer conn = request->body_connection;
- if (!conn) {
+ if (conn.getRaw() == NULL) {
debug(33, 5) ("clientReadBody: no body to read, request=%p\n", request);
callback(buf, 0, cbdata); /* Signal end of body */
return;
body.process();
}
-ClientBody::ClientBody(ConnStateData *aConn) : conn(aConn), buf (NULL), callback(NULL), request(NULL)
+ClientBody::ClientBody(ConnStateData::Pointer &aConn) : conn(aConn), buf (NULL), callback(NULL), request(NULL)
{}
void
int
clientAbortBody(request_t * request)
{
- ConnStateData *conn = request->body_connection;
+ ConnStateData::Pointer conn = request->body_connection;
char *buf;
CBCB *callback;
request->body_connection = NULL;
- if (!conn || conn->body.size_left <= 0)
+ if (conn.getRaw() == NULL || conn->body.size_left <= 0)
return 0; /* No body to abort */
if (conn->body.callback != NULL) {
requestUnlink(request);
}
- clientReadBodyAbortHandler(NULL, -1, conn); /* Install abort handler */
+ clientReadBodyAbortHandler(NULL, -1, conn.getRaw()); /* Install abort handler */
/* ClientBody::process() */
return 1; /* Aborted */
}
clientLifetimeTimeout(int fd, void *data)
{
clientHttpRequest *http = (clientHttpRequest *)data;
- ConnStateData *conn = http->getConn();
debug(33,
1) ("WARNING: Closing client %s connection due to lifetime timeout\n",
- inet_ntoa(conn->peer.sin_addr));
+ inet_ntoa(http->getConn()->peer.sin_addr));
debug(33, 1) ("\t%s\n", http->uri);
comm_close(fd);
}
clientAclChecklistCreate(const acl_access * acl, clientHttpRequest * http)
{
ACLChecklist *ch;
- ConnStateData *conn = http->getConn();
- ch = aclChecklistCreate(acl, http->request, conn ? conn->rfc931 : dash_str);
+ ConnStateData::Pointer conn = http->getConn();
+ ch = aclChecklistCreate(acl, http->request, conn.getRaw() != NULL ? conn->rfc931 : dash_str);
/*
* hack for ident ACL. It needs to get full addresses, and a place to store
* the server end.
*/
- if (conn)
- ch->conn(cbdataReference(conn)); /* unreferenced in acl.cc */
+ if (conn.getRaw() != NULL)
+ ch->conn(conn); /* unreferenced in acl.cc */
return ch;
}
delete this;
}
-ConnStateData::ConnStateData() : transparent_ (false), reading_ (false)
+ConnStateData::ConnStateData() : transparent_ (false), reading_ (false), open_(true)
{}
bool
/*
- * $Id: client_side.h,v 1.2 2003/03/15 04:17:39 robertc Exp $
+ * $Id: client_side.h,v 1.3 2003/07/11 01:40:36 robertc Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
#define SQUID_CLIENTSIDE_H
#include "StoreIOBuffer.h"
+#include "RefCount.h"
class ConnStateData;
clientStreamNode * getTail() const;
clientStreamNode * getClientReplyContext() const;
void connIsFinished();
- void removeFromConnectionList(ConnStateData * conn);
+ void removeFromConnectionList(RefCount<ConnStateData> conn);
void deferRecipientForLater(clientStreamNode * node, HttpReply * rep, StoreIOBuffer recievedData);
bool multipartRangeRequest() const;
void packRange(const char **buf,
bool connRegistered_;
};
-class ConnStateData
+class ConnStateData : public RefCountable
{
public:
+ typedef RefCount<ConnStateData> Pointer;
void * operator new (size_t);
void operator delete (void *);
void deleteSelf() const;
ClientSocketContext::Pointer getCurrentContext() const;
void addContextToQueue(ClientSocketContext * context);
int getConcurrentRequestCount() const;
+ void close();
+ bool isOpen() const;
int fd;
CBDATA_CLASS(ConnStateData);
bool transparent_;
bool reading_;
+ bool open_;
};
#endif /* SQUID_CLIENTSIDE_H */
/*
- * $Id: client_side_reply.cc,v 1.57 2003/07/10 11:04:06 robertc Exp $
+ * $Id: client_side_reply.cc,v 1.58 2003/07/11 01:40:36 robertc Exp $
*
* DEBUG: section 88 Client-side Reply Routines
* AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c)
(long int) entry->lastmod);
http->storeEntry(entry);
assert(http->out.offset == 0);
- fwdStart(http->getConn() ? http->getConn()->fd : -1, http->storeEntry(), http->request);
+ fwdStart(http->getConn().getRaw() != NULL ? http->getConn()->fd : -1, http->storeEntry(), http->request);
/* Register with storage manager to receive updates when data comes in. */
if (EBIT_TEST(entry->flags, ENTRY_ABORTED))
if (http->flags.internal)
r->protocol = PROTO_INTERNAL;
- fwdStart(http->getConn() ? http->getConn()->fd : -1, http->storeEntry(), r);
+ fwdStart(http->getConn().getRaw() != NULL ? http->getConn()->fd : -1, http->storeEntry(), r);
}
}
debug(88, 1) ("WARNING: closing FD %d to prevent counter overflow\n",
fd);
debug(88, 1) ("\tclient %s\n",
- inet_ntoa(http->getConn() ? http->getConn()->peer.sin_addr : no_addr));
+ inet_ntoa(http->getConn().getRaw() != NULL ? http->getConn()->peer.sin_addr : no_addr));
debug(88, 1) ("\treceived %d bytes\n", (int) http->out.size);
debug(88, 1) ("\tURI %s\n", http->log_uri);
return 1;
debug(88, 1) ("WARNING: closing FD %d to prevent counter overflow\n",
fd);
debug(88, 1) ("\tclient %s\n",
- inet_ntoa(http->getConn() ? http->getConn()->peer.sin_addr : no_addr));
+ inet_ntoa(http->getConn().getRaw() != NULL ? http->getConn()->peer.sin_addr : no_addr));
debug(88, 1) ("\treceived %d bytes (offset %d)\n", (int) http->out.size,
(int) http->out.offset);
debug(88, 1) ("\tURI %s\n", http->log_uri);
if (http->isReplyBodyTooLarge(rep->content_length)) {
ErrorState *err =
clientBuildError(ERR_TOO_BIG, HTTP_FORBIDDEN, NULL,
- http->getConn() ? &http->getConn()->peer.sin_addr : &no_addr,
+ http->getConn().getRaw() != NULL ? &http->getConn()->peer.sin_addr : &no_addr,
http->request);
removeClientStoreReference(&sc, http);
startError(err);
ErrorState *err;
err =
clientBuildError(ERR_ACCESS_DENIED, HTTP_FORBIDDEN, NULL,
- http->getConn() ? &http->getConn()->peer.sin_addr : &no_addr,
+ http->getConn().getRaw() != NULL ? &http->getConn()->peer.sin_addr : &no_addr,
http->request);
removeClientStoreReference(&sc, http);
startError(err);
StoreEntry *entry = http->storeEntry();
- ConnStateData *conn = http->getConn();
+ ConnStateData::Pointer conn = http->getConn();
- int fd = conn ? conn->fd : -1;
+ int fd = conn.getRaw() != NULL ? conn->fd : -1;
char *buf = next()->readBuffer.data;
/*
- * $Id: client_side_request.cc,v 1.26 2003/07/10 11:04:06 robertc Exp $
+ * $Id: client_side_request.cc,v 1.27 2003/07/11 01:40:36 robertc Exp $
*
* DEBUG: section 85 Client-side Request Routines
* AUTHOR: Robert Collins (Originally Duane Wessels in client_side.c)
* found the end of the body yet
*/
- if (request && request->body_connection)
+ if (request && request->body_connection.getRaw() != NULL)
clientAbortBody(request); /* abort body transter */
/* the ICP check here was erroneous
RequestMethodStr[http->request->method], http->uri,
answer == ACCESS_ALLOWED ? "ALLOWED" : "DENIED",
AclMatchedName ? AclMatchedName : "NO ACL's");
- proxy_auth_msg = authenticateAuthUserRequestMessage((http->getConn()
+ proxy_auth_msg = authenticateAuthUserRequestMessage((http->getConn().getRaw() != NULL
&& http->getConn()->auth_user_request) ? http->getConn()->
auth_user_request : http->request->auth_user_request);
assert (repContext);
repContext->setReplyToError(page_id, status,
http->request->method, NULL,
- http->getConn() ? &http->getConn()->peer.sin_addr : &no_addr, http->request,
- NULL, http->getConn()
+ http->getConn().getRaw() != NULL ? &http->getConn()->peer.sin_addr : &no_addr, http->request,
+ NULL, http->getConn().getRaw() != NULL
&& http->getConn()->auth_user_request ? http->getConn()->
auth_user_request : http->request->auth_user_request);
node = (clientStreamNode *)http->client_stream.tail->data;
authenticateAuthUserRequestLock(new_request->auth_user_request);
}
- if (old_request->body_connection) {
+ if (old_request->body_connection.getRaw() != NULL) {
new_request->body_connection = old_request->body_connection;
old_request->body_connection = NULL;
}
#endif
/* FIXME PIPELINE: This is innacurate during pipelining */
- if (http->getConn())
+ if (http->getConn().getRaw() != NULL)
fd_note(http->getConn()->fd, http->uri);
assert(http->uri);
/*
- * $Id: client_side_request.cci,v 1.2 2003/07/10 11:04:06 robertc Exp $
+ * $Id: client_side_request.cci,v 1.3 2003/07/11 01:40:36 robertc Exp $
*
* DEBUG: section 85 Client-side Request Routines
* AUTHOR: Robert Collins
return NULL;
}
-ConnStateData *
+ConnStateData::Pointer
ClientHttpRequest::getConn()
{
return conn_;
}
-ConnStateData const *
+ConnStateData::Pointer const
ClientHttpRequest::getConn() const
{
return conn_;
}
void
-ClientHttpRequest::setConn(ConnStateData *aConn)
+ClientHttpRequest::setConn(ConnStateData::Pointer aConn)
{
- assert (!conn_ || !aConn);
+ assert (conn_.getRaw() == NULL || aConn.getRaw() == NULL);
conn_ = aConn;
}
/*
- * $Id: client_side_request.h,v 1.13 2003/07/10 11:04:06 robertc Exp $
+ * $Id: client_side_request.h,v 1.14 2003/07/11 01:40:36 robertc Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
#include "HttpHeader.h"
#include "clientStream.h"
+#include "client_side.h"
/* client_side_request.c - client side request related routines (pure logic) */
extern int clientBeginRequest(method_t, char const *, CSCB *, CSD *, ClientStreamData, HttpHeader const *, char *, size_t);
_SQUID_INLINE_ StoreEntry *storeEntry() const;
void storeEntry(StoreEntry *);
- _SQUID_INLINE_ ConnStateData *getConn();
- _SQUID_INLINE_ ConnStateData const *getConn() const;
- _SQUID_INLINE_ void setConn(ConnStateData *);
+ _SQUID_INLINE_ ConnStateData::Pointer getConn();
+ _SQUID_INLINE_ ConnStateData::Pointer const getConn() const;
+ _SQUID_INLINE_ void setConn(ConnStateData::Pointer);
request_t *request; /* Parsed URL ... */
char *uri;
char *log_uri;
CBDATA_CLASS(ClientHttpRequest);
ssize_t maxReplyBodySize_;
StoreEntry *entry_;
- ConnStateData *conn_;
+ ConnStateData::Pointer conn_;
};
/* client http based routines */
/*
- * $Id: external_acl.cc,v 1.48 2003/07/09 14:14:58 hno Exp $
+ * $Id: external_acl.cc,v 1.49 2003/07/11 01:40:36 robertc Exp $
*
* DEBUG: section 82 External ACL
* AUTHOR: Henrik Nordstrom, MARA Systems AB
#include "ACLIdent.h"
#endif
#include "client_side.h"
+#include "HttpRequest.h"
#ifndef DEFAULT_EXTERNAL_ACL_TTL
#define DEFAULT_EXTERNAL_ACL_TTL 1 * 60 * 60
/*
- * $Id: forward.cc,v 1.105 2003/07/09 11:02:28 hno Exp $
+ * $Id: forward.cc,v 1.106 2003/07/11 01:40:36 robertc Exp $
*
* DEBUG: section 17 Request Forwarding
* AUTHOR: Duane Wessels
* even if the method is indempotent
*/
- if (fwdState->request->body_connection)
+ if (fwdState->request->body_connection.getRaw() != NULL)
return 0;
/* RFC2616 9.1 Safe and Idempotent Methods */
/*
- * $Id: http.cc,v 1.417 2003/06/27 22:32:31 hno Exp $
+ * $Id: http.cc,v 1.418 2003/07/11 01:40:36 robertc Exp $
*
* DEBUG: section 11 Hypertext Transfer Protocol (HTTP)
* AUTHOR: Harvest Derived
debug(11, 5) ("httpSendRequest: FD %d: httpState %p.\n", httpState->fd,
httpState);
- if (httpState->orig_request->body_connection)
+ if (httpState->orig_request->body_connection.getRaw() != NULL)
sendHeaderDone = httpSendRequestEntity;
else
sendHeaderDone = HttpStateData::SendComplete;
/*
- * $Id: mem.cc,v 1.79 2003/06/19 13:27:50 hno Exp $
+ * $Id: mem.cc,v 1.80 2003/07/11 01:40:36 robertc Exp $
*
* DEBUG: section 13 High Level Memory Pool Management
* AUTHOR: Harvest Derived
/* XXX make these classes do their own memory management */
#include "HttpHdrContRange.h"
+#include "HttpRequest.h"
void
Mem::Init(void)
/*
- * $Id: redirect.cc,v 1.99 2003/07/10 11:04:06 robertc Exp $
+ * $Id: redirect.cc,v 1.100 2003/07/11 01:40:36 robertc Exp $
*
* DEBUG: section 61 Redirector
* AUTHOR: Duane Wessels
void
redirectStart(clientHttpRequest * http, RH * handler, void *data)
{
- ConnStateData *conn = http->getConn();
+ ConnStateData::Pointer conn = http->getConn();
redirectStateData *r = NULL;
const char *fqdn;
char buf[8192];
/*
- * $Id: refresh.cc,v 1.60 2003/02/21 22:50:10 robertc Exp $
+ * $Id: refresh.cc,v 1.61 2003/07/11 01:40:37 robertc Exp $
*
* DEBUG: section 22 Refresh Calculation
* AUTHOR: Harvest Derived
#include "squid.h"
#include "Store.h"
#include "MemObject.h"
+#include "HttpRequest.h"
typedef enum {
rcHTTP,
/*
- * $Id: stat.cc,v 1.377 2003/07/10 11:04:06 robertc Exp $
+ * $Id: stat.cc,v 1.378 2003/07/11 01:40:37 robertc Exp $
*
* DEBUG: section 18 Cache Manager Statistics
* AUTHOR: Harvest Derived
{
dlink_node *i;
clientHttpRequest *http;
- ConnStateData *conn;
StoreEntry *e;
int fd;
for (i = ClientActiveRequests.head; i; i = i->next) {
http = static_cast<clientHttpRequest *>(i->data);
assert(http);
- conn = http->getConn();
- storeAppendPrintf(s, "Connection: %p\n", conn);
+ ConnStateData::Pointer conn = http->getConn();
+ storeAppendPrintf(s, "Connection: %p\n", conn.getRaw());
- if (conn) {
+ if (conn.getRaw() != NULL) {
fd = conn->fd;
storeAppendPrintf(s, "\tFD %d, read %d, wrote %d\n", fd,
fd_table[fd].bytes_read, fd_table[fd].bytes_written);
/*
- * $Id: store_client.cc,v 1.128 2003/06/24 12:42:27 robertc Exp $
+ * $Id: store_client.cc,v 1.129 2003/07/11 01:40:37 robertc Exp $
*
* DEBUG: section 90 Storage Manager Client-Side Interface
* AUTHOR: Duane Wessels
#if DELAY_POOLS
#include "DelayPools.h"
#endif
+#include "HttpRequest.h"
CBDATA_TYPE(store_client);
/*
- * $Id: store_key_md5.cc,v 1.29 2003/02/21 22:50:12 robertc Exp $
+ * $Id: store_key_md5.cc,v 1.30 2003/07/11 01:40:37 robertc Exp $
*
* DEBUG: section 20 Storage Manager MD5 Cache Keys
* AUTHOR: Duane Wessels
*/
#include "squid.h"
+#include "HttpRequest.h"
static cache_key null_key[MD5_DIGEST_CHARS];
/*
- * $Id: structs.h,v 1.470 2003/07/09 14:14:58 hno Exp $
+ * $Id: structs.h,v 1.471 2003/07/11 01:40:37 robertc Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
class ConnStateData;
-class request_t
-{
-
-public:
- bool multipartRangeRequest() const;
-
- method_t method;
- protocol_t protocol;
- char login[MAX_LOGIN_SZ];
- char host[SQUIDHOSTNAMELEN + 1];
- auth_user_request_t *auth_user_request;
- u_short port;
- String urlpath;
- char *canonical;
- int link_count; /* free when zero */
- request_flags flags;
- HttpHdrCc *cache_control;
- HttpHdrRange *range;
- http_version_t http_ver;
- time_t ims;
- int imslen;
- int max_forwards;
- /* these in_addr's could probably be sockaddr_in's */
-
- struct in_addr client_addr;
-
- struct in_addr my_addr;
- unsigned short my_port;
- unsigned short client_port;
- HttpHeader header;
- ConnStateData *body_connection; /* used by clientReadBody() */
- int content_length;
- HierarchyLogEntry hier;
- err_type errType;
- char *peer_login; /* Configured peer login:password */
- time_t lastmod; /* Used on refreshes */
- const char *vary_headers; /* Used when varying entities are detected. Changes how the store key is calculated */
- char *peer_domain; /* Configured peer forceddomain */
- String tag; /* Internal tag for this request */
- String extacl_user; /* User name returned by extacl lookup */
- String extacl_passwd; /* Password returned by extacl lookup */
- String extacl_log; /* String to be used for access.log purposes */
-};
-
+class request_t;
#endif
struct _cachemgr_passwd
/*
- * $Id: whois.cc,v 1.24 2003/02/21 22:50:13 robertc Exp $
+ * $Id: whois.cc,v 1.25 2003/07/11 01:40:37 robertc Exp $
*
* DEBUG: section 75 WHOIS protocol
* AUTHOR: Duane Wessels, Kostas Anagnostakis
#include "Store.h"
#include "HttpReply.h"
#include "comm.h"
+#include "HttpRequest.h"
#define WHOIS_PORT 43