Skip to content

Commit

Permalink
Maintenance: Remove unused clientBeginRequest() (squid-cache#1910)
Browse files Browse the repository at this point in the history
This ESI-only function became unused since recent commit 5eb89ef. It
has enough problematic code and comments to justify dedicated removal.
  • Loading branch information
rousskov authored and squid-anubis committed Oct 8, 2024
1 parent 416f3ec commit 0e4873f
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 101 deletions.
3 changes: 1 addition & 2 deletions doc/Programming-Guide/05_TypicalRequestFlow.dox
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@

\par
\li A client connection is accepted by the client-side socket
support and parsed, or is directly created via
clientBeginRequest().
support and parsed.

\li The access controls are checked. The client-side-request builds
an ACL state data structure and registers a callback function
Expand Down
1 change: 1 addition & 0 deletions src/Downloader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "client_side_reply.h"
#include "client_side_request.h"
#include "ClientRequestContext.h"
#include "clientStream.h"
#include "Downloader.h"
#include "fatal.h"
#include "http/one/RequestParser.h"
Expand Down
1 change: 1 addition & 0 deletions src/client_side_reply.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "acl/Gadgets.h"
#include "anyp/PortCfg.h"
#include "client_side_reply.h"
#include "clientStream.h"
#include "errorpage.h"
#include "ETag.h"
#include "fd.h"
Expand Down
95 changes: 0 additions & 95 deletions src/client_side_request.cc
Original file line number Diff line number Diff line change
Expand Up @@ -268,101 +268,6 @@ ClientHttpRequest::~ClientHttpRequest()
dlinkDelete(&active, &ClientActiveRequests);
}

/**
* Create a request and kick it off
*
* \retval 0 success
* \retval -1 failure
*
* TODO: Pass in the buffers to be used in the initial Read request, as they are
* determined by the user
*/
int
clientBeginRequest(const HttpRequestMethod &method, char const *url, CSCB *streamcallback,
CSD *streamdetach, const ClientStreamData &streamdata, const HttpHeader *header,
char *tailbuf, size_t taillen, const MasterXaction::Pointer &mx)
{
size_t url_sz;
ClientHttpRequest *http = new ClientHttpRequest(nullptr);
HttpRequest *request;
StoreIOBuffer tempBuffer;
if (http->al != nullptr)
http->al->cache.start_time = current_time;
/* this is only used to adjust the connection offset in client_side.c */
http->req_sz = 0;
tempBuffer.length = taillen;
tempBuffer.data = tailbuf;
/* client stream setup */
clientStreamInit(&http->client_stream, clientGetMoreData, clientReplyDetach,
clientReplyStatus, new clientReplyContext(http), streamcallback,
streamdetach, streamdata, tempBuffer);
/* make it visible in the 'current acctive requests list' */
/* Set flags */
/* internal requests only makes sense in an
* accelerator today. TODO: accept flags ? */
http->flags.accel = true;
/* allow size for url rewriting */
url_sz = strlen(url) + Config.appendDomainLen + 5;
http->uri = (char *)xcalloc(url_sz, 1);
strcpy(http->uri, url); // XXX: polluting http->uri before parser validation

request = HttpRequest::FromUrlXXX(http->uri, mx, method);
if (!request) {
debugs(85, 5, "Invalid URL: " << http->uri);
return -1;
}

/*
* now update the headers in request with our supplied headers.
* HttpRequest::FromUrl() should return a blank header set, but
* we use Update to be sure of correctness.
*/
if (header)
request->header.update(header);

/* http struct now ready */

/*
* build new header list *? TODO
*/
request->flags.accelerated = http->flags.accel;

/* this is an internally created
* request, not subject to acceleration
* target overrides */
// TODO: detect and handle internal requests of internal objects?

/* Internally created requests cannot have bodies today */
request->content_length = 0;

request->client_addr.setNoAddr();

#if FOLLOW_X_FORWARDED_FOR
request->indirect_client_addr.setNoAddr();
#endif /* FOLLOW_X_FORWARDED_FOR */

request->my_addr.setNoAddr(); /* undefined for internal requests */

request->my_addr.port(0);

request->http_ver = Http::ProtocolVersion();

http->initRequest(request);

/* optional - skip the access check ? */
http->calloutContext = new ClientRequestContext(http);

http->calloutContext->http_access_done = false;

http->calloutContext->redirect_done = true;

http->calloutContext->no_cache_done = true;

http->doCallouts();

return 0;
}

bool
ClientRequestContext::httpStateIsValid()
{
Expand Down
4 changes: 0 additions & 4 deletions src/client_side_request.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "AccessLogEntry.h"
#include "acl/FilledChecklist.h"
#include "client_side.h"
#include "clientStream.h"
#include "http/forward.h"
#include "HttpHeaderRange.h"
#include "log/forward.h"
Expand All @@ -28,9 +27,6 @@ class ClientRequestContext;
class ConnStateData;
class MemObject;

/* client_side_request.c - client side request related routines (pure logic) */
int clientBeginRequest(const HttpRequestMethod &, char const *, CSCB *, CSD *, const ClientStreamData &, const HttpHeader *, char *, size_t, const MasterXactionPointer &);

class ClientHttpRequest
#if USE_ADAPTATION
: public Adaptation::Initiator, // to start adaptation transactions
Expand Down
1 change: 1 addition & 0 deletions src/http/Stream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "squid.h"
#include "client_side_request.h"
#include "clientStream.h"
#include "http/Stream.h"
#include "HttpHdrContRange.h"
#include "HttpHeaderTools.h"
Expand Down
1 change: 1 addition & 0 deletions src/redirect.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "client_side.h"
#include "client_side_reply.h"
#include "client_side_request.h"
#include "clientStream.h"
#include "comm/Connection.h"
#include "fde.h"
#include "format/Format.h"
Expand Down
1 change: 1 addition & 0 deletions src/servers/Http1Server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "client_side.h"
#include "client_side_reply.h"
#include "client_side_request.h"
#include "clientStream.h"
#include "comm/Write.h"
#include "http/one/RequestParser.h"
#include "http/Stream.h"
Expand Down

0 comments on commit 0e4873f

Please sign in to comment.