Add path-style hosting to plugin #12
Triggered via pull request
February 29, 2024 23:14
jhiemstrawisc
opened
#18
Status
Success
Total duration
41s
Artifacts
–
Annotations
1 error and 9 warnings
Run linters
This action does not have permission to push to forks. You may want to run it only on `push` events.
|
Run linters:
src/S3Commands.cc#L37
[lint] reported by reviewdog 🐶
Raw Output:
src/S3Commands.cc:37:-// Takes in the configured `s3.service_url` and uses the bucket/object requested to generate
src/S3Commands.cc:38:-// the virtual host URL, as well as the canonical URI (which is the path to the object).
src/S3Commands.cc:39:-bool AmazonRequest::parseURL( const std::string & url,
src/S3Commands.cc:40:- const std::string & bucket,
src/S3Commands.cc:41:- const std::string & object,
src/S3Commands.cc:42:- std::string & host,
src/S3Commands.cc:43:- std::string & path ) {
src/S3Commands.cc:44:- auto i = url.find( "://" );
src/S3Commands.cc:45:- if( i == std::string::npos ) { return false; }
src/S3Commands.cc:46:- //protocol = substring( url, 0, i );
src/S3Commands.cc:47:-
src/S3Commands.cc:48:- auto j = url.find( "/", i + 3 );
src/S3Commands.cc:49:- if( j == std::string::npos ) {
src/S3Commands.cc:50:- if (style == "path") {
src/S3Commands.cc:51:- host = substring( url, i + 3 );
src/S3Commands.cc:52:- } else {
src/S3Commands.cc:53:- host = bucket + "." + substring( url, i + 3 );
src/S3Commands.cc:54:- }
src/S3Commands.cc:55:-
src/S3Commands.cc:56:- path = "/" + object;
src/S3Commands.cc:57:- return true;
src/S3Commands.cc:38:+// Takes in the configured `s3.service_url` and uses the bucket/object requested
src/S3Commands.cc:39:+// to generate the virtual host URL, as well as the canonical URI (which is the
src/S3Commands.cc:40:+// path to the object).
src/S3Commands.cc:41:+bool AmazonRequest::parseURL(const std::string &url, const std::string &bucket,
src/S3Commands.cc:42:+ const std::string &object, std::string &host,
src/S3Commands.cc:43:+ std::string &path) {
src/S3Commands.cc:44:+ auto i = url.find("://");
src/S3Commands.cc:45:+ if (i == std::string::npos) {
src/S3Commands.cc:46:+ return false;
src/S3Commands.cc:47:+ }
src/S3Commands.cc:48:+ // protocol = substring( url, 0, i );
src/S3Commands.cc:49:+
src/S3Commands.cc:50:+ auto j = url.find("/", i + 3);
src/S3Commands.cc:51:+ if (j == std::string::npos) {
src/S3Commands.cc:52:+ if (style == "path") {
src/S3Commands.cc:53:+ host = substring(url, i + 3);
src/S3Commands.cc:54:+ } else {
src/S3Commands.cc:55:+ host = bucket + "." + substring(url, i + 3);
|
Run linters:
src/S3File.cc#L82
[lint] reported by reviewdog 🐶
Raw Output:
src/S3File.cc:82:-
src/S3File.cc:83:-int
src/S3File.cc:84:-S3File::Open(const char *path, int Oflag, mode_t Mode, XrdOucEnv &env)
src/S3File.cc:85:-{
src/S3File.cc:86:- std::string configured_s3_region = m_oss->getS3Region();
src/S3File.cc:87:-
src/S3File.cc:88:- //
src/S3File.cc:89:- // Check the path for validity.
src/S3File.cc:90:- //
src/S3File.cc:91:- std::string bucket, object;
src/S3File.cc:92:- int rv = parse_path( * m_oss, path, bucket, object );
src/S3File.cc:93:- if( rv != 0 ) { return rv; }
src/S3File.cc:94:-
src/S3File.cc:95:-
src/S3File.cc:96:- std::string configured_s3_service_url = m_oss->getS3ServiceURL();
src/S3File.cc:97:- std::string configured_s3_access_key = m_oss->getS3AccessKeyFile();
src/S3File.cc:98:- std::string configured_s3_secret_key = m_oss->getS3SecretKeyFile();
src/S3File.cc:99:- std::string configured_s3_url_style = m_oss->getS3URLStyle();
src/S3File.cc:100:-
src/S3File.cc:101:-
src/S3File.cc:102:- // We used to query S3 here to see if the object existed, but of course
src/S3File.cc:103:- // if you're creating a file on upload, you don't care.
src/S3File.cc:104:-
src/S3File.cc:105:- this->s3_object_name = object;
src/S3File.cc:106:- this->s3_bucket_name = bucket;
src/S3File.cc:107:- this->s3_service_url = configured_s3_service_url;
src/S3File.cc:108:- this->s3_access_key = configured_s3_access_key;
src/S3File.cc:109:- this->s3_secret_key = configured_s3_secret_key;
src/S3File.cc:110:- this->s3_url_style = configured_s3_url_style;
src/S3File.cc:111:- return 0;
src/S3File.cc:83:+int S3File::Open(const char *path, int Oflag, mode_t Mode, XrdOucEnv &env) {
src/S3File.cc:84:+ std::string configured_s3_region = m_oss->getS3Region();
src/S3File.cc:85:+
src/S3File.cc:86:+ //
src/S3File.cc:87:+ // Check the path for validity.
src/S3File.cc:88:+ //
src/S3File.cc:89:+ std::string bucket, object;
src/S3File.cc:90:+ int rv = parse_path(*m_oss, path, bucket, object);
src/S3File.cc:91:+ if (rv != 0) {
src/S3File.cc:92:+ return rv;
src/S3File.cc:93:+ }
src/S3File.cc:94:+
src/S3File.cc:95:+ std::string configured_s3_service_url = m_oss->getS3ServiceURL();
src/S3File.cc:96:+ std::string configured_s3_access_key = m_oss->getS3AccessKeyFile();
src/S3File.cc:97:+ std::string configured_s3_secret_key = m_oss->getS3SecretKeyFile();
src/S3File.cc:98:+ std::string configured_s3_url_style = m_oss->getS3URLStyle();
src/S3File.cc:99:+
src/S3File.cc:100:+ // We used to query S3 here to see if the object existed, but of course
src/S3File.cc:101:+ // if you're creating a file on upload, you don't care.
src/S3File.cc:102:+
src/S3File.cc:103:+ this->s3_object_name = object;
src/S3File.cc:104:+ this->s3_bucket_name = bucket;
src/S3File.cc:105:+ this->s3_service_url = configured_s3_service_url;
src/S3File.cc:106:+ this->s3_access_key = configured_s3_access_key;
src/S3File.cc:107:+ this->s3_secret_key = configured_s3_secret_key;
src/S3File.cc:108:+ this->s3_url_style = configured_s3_url_style;
src/S3File.cc:109:+ return 0;
|
Run linters:
src/S3File.cc#L115
[lint] reported by reviewdog 🐶
Raw Output:
src/S3File.cc:115:-ssize_t
src/S3File.cc:116:-S3File::Read(void *buffer, off_t offset, size_t size)
src/S3File.cc:117:-{
src/S3File.cc:118:- AmazonS3Download download(
src/S3File.cc:119:- this->s3_service_url,
src/S3File.cc:120:- this->s3_access_key,
src/S3File.cc:121:- this->s3_secret_key,
src/S3File.cc:122:- this->s3_bucket_name,
src/S3File.cc:123:- this->s3_object_name,
src/S3File.cc:124:- this->s3_url_style
src/S3File.cc:125:- );
src/S3File.cc:126:-
src/S3File.cc:127:-
src/S3File.cc:128:- if(! download.SendRequest( offset, size ) ) {
src/S3File.cc:129:- fprintf( stderr, "D_FULLDEBUG: failed to send GetObject command: %lu '%s'\n", download.getResponseCode(), download.getResultString().c_str() );
src/S3File.cc:130:- return 0;
src/S3File.cc:131:- }
src/S3File.cc:117:+ if (!download.SendRequest(offset, size)) {
src/S3File.cc:118:+ fprintf(stderr, "D_FULLDEBUG: failed to send GetObject command: %lu '%s'\n",
src/S3File.cc:119:+ download.getResponseCode(), download.getResultString().c_str());
src/S3File.cc:120:+ return 0;
src/S3File.cc:121:+ }
|
Run linters:
src/S3File.cc#L138
[lint] reported by reviewdog 🐶
Raw Output:
src/S3File.cc:138:-
src/S3File.cc:139:-int
src/S3File.cc:140:-S3File::Fstat(struct stat *buff)
src/S3File.cc:141:-{
src/S3File.cc:142:- AmazonS3Head head(
src/S3File.cc:143:- this->s3_service_url,
src/S3File.cc:144:- this->s3_access_key,
src/S3File.cc:145:- this->s3_secret_key,
src/S3File.cc:146:- this->s3_bucket_name,
src/S3File.cc:147:- this->s3_object_name,
src/S3File.cc:148:- this->s3_url_style
src/S3File.cc:149:- );
src/S3File.cc:150:-
src/S3File.cc:151:- if(! head.SendRequest()) {
src/S3File.cc:152:- // SendRequest() returns false for all errors, including ones
src/S3File.cc:153:- // where the server properly responded with something other
src/S3File.cc:154:- // than code 200. If xrootd wants us to distinguish between
src/S3File.cc:155:- // these cases, head.getResponseCode() is initialized to 0, so
src/S3File.cc:156:- // we can check.
src/S3File.cc:157:- fprintf( stderr, "D_FULLDEBUG: failed to send HeadObject command: %lu '%s'\n", head.getResponseCode(), head.getResultString().c_str() );
src/S3File.cc:158:- return -ENOENT;
src/S3File.cc:159:- }
src/S3File.cc:160:-
src/S3File.cc:161:-
src/S3File.cc:162:- std::string headers = head.getResultString();
src/S3File.cc:163:-
src/S3File.cc:164:- std::string line;
src/S3File.cc:165:- size_t current_newline = 0;
src/S3File.cc:166:- size_t next_newline = std::string::npos;
src/S3File.cc:167:- size_t last_character = headers.size();
src/S3File.cc:168:- while( current_newline != std::string::npos && current_newline != last_character - 1 ) {
src/S3File.cc:169:- next_newline = headers.find( "\r\n", current_newline + 2);
src/S3File.cc:170:- std::string line = substring( headers, current_newline + 2, next_newline );
src/S3File.cc:171:-
src/S3File.cc:172:- size_t colon = line.find(":");
src/S3File.cc:173:- if( colon != std::string::npos && colon != line.size() ) {
src/S3File.cc:174:- std::string attr = substring( line, 0, colon );
src/S3File.cc:175:- std::string value = substring( line, colon + 1 );
src/S3File.cc:176:- trim(value);
src/S3File.cc:177:- toLower(attr);
src/S3File.cc:178:-
src/S3File.cc:179:- if( attr == "content-length" ) {
src/S3File.cc:180:- this->content_length = std::stol(value);
src/S3File.cc:181:- } else if( attr == "last-modified" ) {
src/S3File.cc:182:- struct tm t;
src/S3File.cc:183:- char * eos = strptime( value.c_str(),
src/S3File.cc:184:- "%a, %d %b %Y %T %Z",
src/S3File.cc:185:- & t );
src/S3File.cc:186:- if( eos == & value.c_str()[value.size()] ) {
src/S3File.cc:187:- time_t epoch = timegm(& t);
src/S3File.cc:188:- if( epoch != -1 ) {
src/S3File.cc:189:- this->last_modified = epoch;
src/S3File.cc:190:- }
src/S3File.cc:191:- }
src/S3File.cc:192:- }
src/S3File.cc:128:+int S3File::Fstat(struct stat *buff) {
src/S3File.cc:129:+ AmazonS3Head head(this->s3_service_url, this->s3_access_key,
src/S3File.cc:130:+ this->s3_secret_key, this->s3_bucket_name,
src/S3File.cc:131:+ this->s3_object_name, this->s3_url_style);
src/S3File.cc:132:+
src/S3File.cc:133:+ if (!head.SendRequest()) {
src/S3File.cc:134:+ // SendRequest() returns false for all errors, including ones
src/S3File.cc:135:+ // where the server properly responded with something other
src/S3File.cc:136:+ // than code 200. If xrootd wants us to distinguish between
src/S3File.cc:137:+ // these cases, head.getResponseCode() is initialized to 0, so
src/S3File.cc:138:+ // we can check.
src/S3File.cc:139:+ fprintf(stderr,
src/S3File.cc:140:+ "D_FULLDEBUG: failed to send HeadObject command: %lu '%s'\n",
src/S3File.cc:141:+ head.getResponseCode(), head.getResultString().c_str()
|
Run linters:
src/S3File.cc#L213
[lint] reported by reviewdog 🐶
Raw Output:
src/S3File.cc:213:-
src/S3File.cc:214:-ssize_t
src/S3File.cc:215:-S3File::Write(const void *buffer, off_t offset, size_t size)
src/S3File.cc:216:-{
src/S3File.cc:217:- AmazonS3Upload upload(
src/S3File.cc:218:- this->s3_service_url,
src/S3File.cc:219:- this->s3_access_key,
src/S3File.cc:220:- this->s3_secret_key,
src/S3File.cc:221:- this->s3_bucket_name,
src/S3File.cc:222:- this->s3_object_name,
src/S3File.cc:223:- this->s3_url_style
src/S3File.cc:224:- );
src/S3File.cc:225:-
src/S3File.cc:226:- std::string payload( (char *)buffer, size );
src/S3File.cc:227:- if(! upload.SendRequest( payload, offset, size )) {
src/S3File.cc:228:- m_log.Emsg( "Open", "upload.SendRequest() failed" );
src/S3File.cc:229:- return -ENOENT;
src/S3File.cc:230:- } else {
src/S3File.cc:231:- m_log.Emsg( "Open", "upload.SendRequest() succeeded" );
src/S3File.cc:232:- return 0;
src/S3File.cc:233:- }
src/S3File.cc:234:-}
src/S3File.cc:235:-
src/S3File.cc:236:-
src/S3File.cc:237:-int S3File::Close(long long *retsz)
src/S3File.cc:238:-{
src/S3File.cc:239:- m_log.Emsg("Close", "Closed our S3 file");
src/S3File.cc:194:+ssize_t S3File::Write(const void *buffer, off_t offset, size_t size) {
src/S3File.cc:195:+ AmazonS3Upload upload(this->s3_service_url, this->s3_access_key,
src/S3File.cc:196:+ this->s3_secret_key, this->s3_bucket_name,
src/S3File.cc:197:+ this->s3_object_name, this->s3_url_style);
src/S3File.cc:198:+
src/S3File.cc:199:+ std::string payload((char *)buffer, size);
src/S3File.cc:200:+ if (!upload.SendRequest(payload, offset, size)) {
src/S3File.cc:201:+ m_log.Emsg("Open", "upload.SendRequest() failed");
src/S3File.cc:202:+ return -ENOENT;
src/S3File.cc:203:+ } else {
src/S3File.cc:204:+ m_log.Emsg("Open", "upload.SendRequest() succeeded");
|
Run linters:
src/S3FileSystem.cc#L70
[lint] reported by reviewdog 🐶
Raw Output:
src/S3FileSystem.cc:69:- char * temporary;
src/S3FileSystem.cc:70:- std::string value;
src/S3FileSystem.cc:71:- std::string attribute;
src/S3FileSystem.cc:72:- Config.Attach(cfgFD);
src/S3FileSystem.cc:73:- while ((temporary = Config.GetMyFirstWord())) {
src/S3FileSystem.cc:74:- attribute = temporary;
src/S3FileSystem.cc:75:- temporary = Config.GetWord();
src/S3FileSystem.cc:76:- if(! temporary) { continue; }
src/S3FileSystem.cc:77:- value = temporary;
src/S3FileSystem.cc:78:-
src/S3FileSystem.cc:79:- if(! handle_required_config( attribute, "s3.service_name",
src/S3FileSystem.cc:80:- value, this->s3_service_name ) ) { Config.Close(); return false; }
src/S3FileSystem.cc:81:- if(! handle_required_config( attribute, "s3.region",
src/S3FileSystem.cc:82:- value, this->s3_region ) ) { Config.Close(); return false; }
src/S3FileSystem.cc:83:- if(! handle_required_config( attribute, "s3.service_url",
src/S3FileSystem.cc:84:- value, this->s3_service_url ) ) { Config.Close(); return false; }
src/S3FileSystem.cc:85:- if(! handle_required_config( attribute, "s3.access_key_file",
src/S3FileSystem.cc:86:- value, this->s3_access_key_file ) ) { Config.Close(); return false; }
src/S3FileSystem.cc:87:- if(! handle_required_config( attribute, "s3.secret_key_file",
src/S3FileSystem.cc:88:- value, this->s3_secret_key_file ) ) { Config.Close(); return false; }
src/S3FileSystem.cc:89:- if(! handle_required_config( attribute, "s3.url_style",
src/S3FileSystem.cc:90:- value, this->s3_url_style ) ) { Config.Close(); return false; }
src/S3FileSystem.cc:73:+ if (!handle_required_config(attribute, "s3.service_name", value,
src/S3FileSystem.cc:74:+ this->s3_service_name)) {
src/S3FileSystem.cc:75:+ Config.Close();
src/S3FileSystem.cc:76:+ return false;
|
Run linters:
src/S3FileSystem.cc#L93
[lint] reported by reviewdog 🐶
Raw Output:
src/S3FileSystem.cc:92:-
src/S3FileSystem.cc:93:- if( this->s3_service_name.empty() ) {
src/S3FileSystem.cc:94:- m_log.Emsg("Config", "s3.service_name not specified");
src/S3FileSystem.cc:95:- return false;
src/S3FileSystem.cc:78:+ if (!handle_required_config(attribute, "s3.region", value,
src/S3FileSystem.cc:79:+ this->s3_region)) {
src/S3FileSystem.cc:80:+ Config.Close();
src/S3FileSystem.cc:81:+ return false;
|
Run linters:
src/S3FileSystem.cc#L113
[lint] reported by reviewdog 🐶
Raw Output:
src/S3FileSystem.cc:112:-
src/S3FileSystem.cc:113:- int retc = Config.LastError();
src/S3FileSystem.cc:114:- if( retc ) {
src/S3FileSystem.cc:115:- m_log.Emsg("Config", -retc, "read config file", configfn);
src/S3FileSystem.cc:116:- Config.Close();
src/S3FileSystem.cc:117:- return false;
src/S3FileSystem.cc:98:+ if (!handle_required_config(attribute, "s3.url_style", value,
src/S3FileSystem.cc:99:+ this->s3_url_style)) {
src/S3FileSystem.cc:100:+ Config.Close();
src/S3FileSystem.cc:101:+ return false;
|
Run linters
Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: actions/checkout@v3, wearerequired/lint-action@v2. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.
|