Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[XrdHttp] Refactoring the read issuing for GET and fix issues 1976, 2076 #2072

Merged
merged 3 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/XrdHttp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ if( BUILD_HTTP )
XrdHttp/XrdHttpStatic.hh
XrdHttp/XrdHttpTrace.hh
XrdHttp/XrdHttpUtils.cc XrdHttp/XrdHttpUtils.hh
XrdHttp/XrdHttpReadRangeHandler.cc XrdHttp/XrdHttpReadRangeHandler.hh
XrdHttp/XrdHttpChecksumHandler.cc XrdHttp/XrdHttpChecksumHandler.hh
XrdHttp/XrdHttpChecksum.cc XrdHttp/XrdHttpChecksum.hh)

Expand Down
10 changes: 8 additions & 2 deletions src/XrdHttp/XrdHttpProtocol.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ int XrdHttpProtocol::m_bio_type = 0; // BIO type identifier for our custom BIO.
BIO_METHOD *XrdHttpProtocol::m_bio_method = NULL; // BIO method constructor.
char *XrdHttpProtocol::xrd_cslist = nullptr;
XrdHttpChecksumHandler XrdHttpProtocol::cksumHandler = XrdHttpChecksumHandler();
XrdHttpReadRangeHandler::Configuration XrdHttpProtocol::ReadRangeConfig;

XrdSysTrace XrdHttpTrace("http");

Expand Down Expand Up @@ -185,7 +186,7 @@ int BIO_get_shutdown(BIO *bio) {

XrdHttpProtocol::XrdHttpProtocol(bool imhttps)
: XrdProtocol("HTTP protocol handler"), ProtLink(this),
SecEntity(""), CurrentReq(this) {
SecEntity(""), CurrentReq(this, ReadRangeConfig) {
myBuff = 0;
Addr_str = 0;
Reset();
Expand Down Expand Up @@ -951,6 +952,10 @@ int XrdHttpProtocol::Config(const char *ConfigFN, XrdOucEnv *myEnv) {
char *var;
int cfgFD, GoNo, NoGo = 0, ismine;

var = nullptr;
XrdOucEnv::Import("XRD_READV_LIMITS", var);
XrdHttpReadRangeHandler::Configure(eDest, var, ReadRangeConfig);

cksumHandler.configure(xrd_cslist);
auto nonIanaChecksums = cksumHandler.getNonIANAConfiguredCksums();
if(nonIanaChecksums.size()) {
Expand Down Expand Up @@ -1527,11 +1532,12 @@ int XrdHttpProtocol::StartSimpleResp(int code, const char *desc, const char *hea
else if (code == 206) ss << "Partial Content";
else if (code == 302) ss << "Redirect";
else if (code == 307) ss << "Temporary Redirect";
else if (code == 400) ss << "Bad Request";
else if (code == 403) ss << "Forbidden";
else if (code == 404) ss << "Not Found";
else if (code == 405) ss << "Method Not Allowed";
else if (code == 416) ss << "Range Not Satisfiable";
else if (code == 500) ss << "Internal Server Error";
else if (code == 400) ss << "Bad Request";
else ss << "Unknown";
}
ss << crlf;
Expand Down
4 changes: 4 additions & 0 deletions src/XrdHttp/XrdHttpProtocol.hh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include "Xrd/XrdProtocol.hh"
#include "XrdOuc/XrdOucHash.hh"
#include "XrdHttpChecksumHandler.hh"
#include "XrdHttpReadRangeHandler.hh"

#include <openssl/ssl.h>

Expand Down Expand Up @@ -129,6 +130,9 @@ public:
// XrdHttp checksum handling class
static XrdHttpChecksumHandler cksumHandler;

/// configuration for the read range handler
static XrdHttpReadRangeHandler::Configuration ReadRangeConfig;

/// called via https
bool isHTTPS() { return ishttps; }

Expand Down