-
Notifications
You must be signed in to change notification settings - Fork 516
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
HTTP PUT output support #737
Conversation
prevent propagation as zero-length PUT request
to mitigate calls to File::GetFileSize
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
1 similar comment
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
Dear Ole Andre, thanks again for taking care about this. Will you also add 8ddbbf0 into the mix? With kind regards, |
@googlebot I signed it! |
Emm... I am not sure if it is because of yours CLA signing, but the bot was complaining "one or more commits were authored or co-authored by someone other than the pull request submitter." I'll see if I can find out. Thanks for your effort on this PR! |
Hi again,
AppVeyor shows different kinds of errors [1]. Is this related somehow?
@kqyang promised to check. Maybe this is related to these two commits by Rintaro Kuroiwa (@rkuroiwa) somehow? At least, both commits are not directly associated with his pen. With kind regards, [1] https://ci.appveyor.com/project/shaka/shaka-packager/builds/35724371/job/d3va1bvda78ago4o |
We are still checking. Apologize for the delay.
It looks like a problem in the test. TEST_F(HttpFileTest, PutChunkedTranser) {
std::unique_ptr<File, FileCloser> writer(
File::Open("put+http://127.0.0.1:8080/test_out", "w"));
ASSERT_TRUE(writer);
ASSERT_EQ(kWriteBufferSize, writer->Write(kWriteBuffer, kWriteBufferSize));
writer.release()->Close();
} [ RUN ] HttpFileTest.PutChunkedTranser
[1013/131933:ERROR:local_file.cc(85)] Failed to create directory put+http: ErrorCode 123
c:\projects\shaka-packager\src\packager\file\http_file_unittest.cc(20): error: Value of: writer
Actual: false
Expected: true
[ FAILED ] HttpFileTest.PutChunkedTranser (27 ms) Should the URL of the file open just be "http://127.0.0.1:8080/test_out"? Also, a separate question, do we support HTTP methods other than "put"? |
@amotl Here is the problem:
We need your consent for this PR. See the instruction at #737 (comment), i.e.
|
Oh, it was me! I believed I had solved this properly already. Thanks! |
@googlebot I consent |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
1 similar comment
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
That's a strange test, but I'm guessing it should be just http since that's the only prefix we're checking for with the
It gives me a 404 if I change the test to
It makes sense that the test is not failing anyway since it's only asserting
It's only doing PUT for now but I see there's code for other methods added in the large commit above, does not seem to be in use. |
Hi there,
It will not be so easy to just remove the prefix. However, I can't remember the intrinsic details that took me to that decision to add the prefix like that - apart from only supporting PUT anyway. I believe it has something to do with that I had to use something like the Will you be able to make it work after sublimating yourself into the code again, @termoose? With kind regards, P.S.: Great so see @joeyparrish is already building upon our work here, see termoose#1. |
The innocent and rather superfluous code like 4491dee ff. has been there for a reason to be able to tell different kinds of files apart. Otherwise, the machinery doesn't know to handle that as HTTP and will try to access the local file system
I can't describe more precisely what I have been going through back then but I can remember it was a bit of a brainfuck because the machinery doesn't offer a way to signal this through all the loosely coupled subsystems between ingress and egress. I would have to review the whole bunch of changes again and compare the current state of the onion against all the commits I made in the past to get back on track with this. |
Is it actually a good sign that AppVeyor build succeeded right now? Maybe all my ramblings above are just moot. If so, sorry for the noise! So, will that be ready to merge? |
Ah I didn't see your But yes the test passes, so that's a bit strange, but I don't see how it could fail actually. The only way I see this test failing is if the |
Dear Ole Andre,
That might well be the case. Magic happens sometimes. ;] Maybe also I was just too stupid back then. Thanks for the fix through a1e5a40. If we need to support other HTTP methods than PUT, we will be able to revisit this later.
Thank you so much! I believe if that will succeed, we will be ready to merge and address other things related to the tests later. With kind regards, |
bool Open() override; | ||
|
||
private: | ||
enum HttpMethod { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to use a C++11 enum class
instead. Also, the names should be kGet
, kPost
, etc.
std::string cert_private_key_file_; | ||
std::string cert_private_key_pass_; | ||
|
||
const uint32_t timeout_in_seconds_; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't really used. It can be added later once support is added. Also, a timeout for a streaming upload isn't that useful since we're streaming in real-time, so it can take a while.
headers = curl_slist_append(headers, "Content-Type: application/octet-stream"); | ||
headers = curl_slist_append(headers, "Transfer-Encoding: chunked"); | ||
|
||
// Don't stop on 200 OK responses. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't wait for a 100-continue
|
||
private: | ||
enum HttpMethod { | ||
GET, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is an upload-only type, using GET won't make sense. I suggest removing it.
|
||
// Perform HTTP request | ||
Status HttpFile::Request(HttpMethod http_method, | ||
const std::string& url, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The URL is in a field, so no need to pass as an argument.
Dear Jacob,
Thanks a bunch for your thorough review. Sorry that most of these shortcomings are coming from the fact that I am not a native C++ speaker. I have been happy that @kqyang and @rkuroiwa guided me the other day when doing the initial work on this. I also want to apologize that I am currently busy with other obligations, so I am humbly asking if you will be able to address these adjustments suggested by Jacob, @termoose? With kind regards, |
Thanks for the very thorough review @TheModMaker! I just started at the top and can continue when time allows, think we should be able to get through these. Most of these changes are not done by me so it's a bit challenging to amend them. |
Hi again, I just wanted to ping you about this again. Because @termoose stated:
I believe most of them are coming from my pen while working on this the other day. However, as I currently don't see any chance to continue working on those, I want to humbly ask if one of the core developers might be able to take over addressing the issues reported by @TheModMaker? With kind regards, |
Hi everyone, @amotl @termoose @TheModMaker @joeyparrish! I was wondering what the status is on this PR? My work uses the HTTP upload feature, and I would love to see it get pulled into master soon. Please let me know if I can help in any way. Cheers, |
We've decided to merge this as-is and I'll make the requested changes. Thanks for the contribution. |
Hi Jacob, thank you very much for integrating this feature and for taking over development. With kind regards, |
Experimental feature support for HTTP ingest.
Relates and hopefully closes issue #149.