snprintf already includes a mechanism to prevent writing
too much into a buffer. The maximum length snprintf will
write is its size. Per manual of snprintf, an insufficient
buffer will result in the function returning size or more.
The common case is this buffer isn't too much. If the
limit is reached, return the MS3_ERR_URI_TOO_LONG like
like before.
With this in place, no pre-processor warning handling is
needed.
Older Clang versions flag `-Wunused-but-set-variable` as an unknown
warning option. So we need `-Wunknown-warning-option` to stop this, but
GCC doesn't know this, so we need `-Wpragmas` for GCC.
Curl automatically sets the content type of
`application/x-www-form-urlencoded`, whilst this hasn't caused us any
problems in the past, Huawei's S3 implementation does not like it. The
two possible options are to remove the content type header, or use mime
multipart uploads.
Multipart uploads could be implemented eventually, but are only really
needed for very large files (> 4GB). So, this patch adds an option to do
the former, disabling the content type. This is not a default option at
the moment and needs to be set using:
```
ms3_set_option(ms3, MS3_OPT_NO_CONTENT_TYPE, NULL);
```
* RTD theme no longer builds with latest Sphinx. This updates it.
* Fix types based docs compile issues.
* Fix compiler warning not seeing a size check.
* Allow custom read callbacks to be used
This allows handling of data in smaller chunks if the ms3_get result is
too large to fit into memory.
* Use the configured buffer size in curl
This way the chunks that curl will return will be the same size that the
internal buffer will be. For the custom read callback, this will allow
the data to be handled in smaller chunks.
* Fix copyright year in read_cb.c
The year is 2023.
The flag seems to be added automatically to shared objects but for the
static library only -fPIE is added. Adding -fPIC should allow the static
library to be linked to other libraries.
Fix spelling: occured -> occurred
> @drrtuy This PR is rather trivial, it should take you only 10 seconds to review and merge.
Sorry. I missed this one.
All new code of the whole pull request, including one or several files
that are either new files or modified ones, are contributed under the
BSD-new license. I am contributing on behalf of my employer Amazon Web
Services, Inc.
The S3 API specification states that x-amz-copy-source should be
urlencoded. libmarias3 wasn't doing this but Amazon's S3 implementation
appeared to be forgiving enough that it didn't matter. When using
compatible APIs such as MinIO this requirement became stricter.
The code now urlencodes the source path for ms3_copy / ms3_move.
In addition this patch adds support for MinIO in the test suite by
adding environment variables for port and disabling https.
- Added missing headers to src/include.am. This made 'make distcheck' work
again!
- Removed not used last argument to execute_assume_role_request()
- Added missing ENUM's to switches. (gcc 7.5.0 on OpenSuse has by default
[-Werror=switch-enum] enabled, which causes this to fail even if there
is a default:)
- In src/responce.c fixed that code is after declarations. This is C,
not C++!
- Re-indented some very long line