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

Custom Uploader improvement #39

Closed
nikolaybobrovskiy opened this issue Jan 20, 2014 · 21 comments
Closed

Custom Uploader improvement #39

nikolaybobrovskiy opened this issue Jan 20, 2014 · 21 comments

Comments

@nikolaybobrovskiy
Copy link

Hello!

I am using Custom Uploader to upload to amazon S3. It uploads successfully, but S3 POST request provides content empty response (just response header is provided) and ShareX reports error (in spite of successful upload). Could you add "Header" to response type in Custom Uploader settings?

Thanks.

@Jaex
Copy link
Member

Jaex commented Jan 20, 2014

How can i test it if i add it?

@nikolaybobrovskiy
Copy link
Author

I can provide response header. Or (if you have AWS account) you can test it via http://s3.amazonaws.com/doc/s3-example-code/post/post_sample.html

@Jaex
Copy link
Member

Jaex commented Jan 20, 2014

It require credit card to register so i can't test it.

@nikolaybobrovskiy
Copy link
Author

I could be a tester :)

@Jaex
Copy link
Member

Jaex commented Jan 20, 2014

I'm not gonna implement something which i can't even test is it working. Working blindly is not an option for programming.

@nikolaybobrovskiy
Copy link
Author

I think that there is nothing special about Amazon S3 POST request. This is just an option to get response header of a POST request. It can be tested on POST request to any site.
As to S3 specially, its response header is:
HTTP/1.1 204 No Content
Date: Mon, 20 Jan 2014 06:03:36 GMT
ETag: "59ddb92e0abe7b8f24d67981e12e97dc"
Location: http://donnicky_screenshots.s3.amazonaws.com/2.img
Server: AmazonS3

@Jaex
Copy link
Member

Jaex commented Jan 20, 2014

How to parse response header? Custom uploader section already don't have any space to insert new controls.
Adding it as uploader will be better choice so other peoples can use it too. But it not gonna happen when it is paid service.

@nikolaybobrovskiy
Copy link
Author

Custom uploader has a combo box with response type. Just add there "Response header". And then it can be parsed by regex as it is already implemented.

@nikolaybobrovskiy
Copy link
Author

I could even do not mention about S3. It is just one more option to get POST request reponse.

@Jaex
Copy link
Member

Jaex commented Jan 20, 2014

Regex applying in response because it is string. But response headers is name value array so how regex can work properly like that?

@nikolaybobrovskiy
Copy link
Author

Just concat the array elements to a single string with some separator I think. Like this:
Date: Mon, 20 Jan 2014 06:03:36 GMT|ETag: "59ddb92e0abe7b8f24d67981e12e97dc"|Location:http://donnicky_screenshots.s3.amazonaws.com/2.img

@Jaex
Copy link
Member

Jaex commented Jan 20, 2014

Now how am i supposed to test it? I need to find one page which returns response headers.

@nikolaybobrovskiy
Copy link
Author

Custom uploader settings to get POST request header response:
{
"Name": "TestPostResponseHeader",
"RequestType": 0,
"RequestURL": "http://donnicky_screenshots.s3.amazonaws.com/",
"FileFormName": "file",
"Arguments": {},
"ResponseType": 0,
"RegexList": [],
"URL": "",
"ThumbnailURL": "",
"DeletionURL": "",
"AutoUseResponse": true,
"Input": null,
"ResultURL": null,
"ResultThumbnailURL": null,
"ResultDeletionURL": null
}

@Jaex
Copy link
Member

Jaex commented Jan 20, 2014

You are using old version of ShareX look like.

@nikolaybobrovskiy
Copy link
Author

Updated:
{
"Name": "TestPostResponseHeader",
"RequestType": 0,
"RequestURL": "http://donnicky_screenshots.s3.amazonaws.com/",
"FileFormName": "file",
"Arguments": {},
"ResponseType": 0,
"RegexList": [],
"URL": "",
"ThumbnailURL": "",
"DeletionURL": ""
}

@Jaex
Copy link
Member

Jaex commented Jan 20, 2014

I still can't test because:
Error: Message:
The remote server returned an error: (400) Bad Request.

@nikolaybobrovskiy
Copy link
Author

Yes, it returns error. But this is a kind of response too, and it also has a header, too. We just need header to convert it to a single string. Why this header is bad for testing?
HTTP/1.1 400 Bad Request
x-amz-request-id: 4868966BDCA8BC69
x-amz-id-2: 63VlGB+Mxipgu23gS9CM2DkYv+kSggsFNc5T1bkUcey47wgst/pESB/MnfNGnOfl
Content-Type: application/xml
Transfer-Encoding: chunked
Date: Mon, 20 Jan 2014 06:46:32 GMT
Connection: close
Server: AmazonS3

@Jaex
Copy link
Member

Jaex commented Jan 20, 2014

I already added it but i can't be sure is it working and your string not verify that my codes works...
I seriously hate this making something and don't know is it works.

@nikolaybobrovskiy
Copy link
Author

Maybe this:
{
"Name": "TestPostResponseHeader",
"RequestType": 0,
"RequestURL": "https://posttestserver.com/post.php",
"FileFormName": "file",
"Arguments": {
"someParam": "someValue"
},
"ResponseType": 0,
"RegexList": [],
"URL": "",
"ThumbnailURL": "",
"DeletionURL": ""
}

@Jaex
Copy link
Member

Jaex commented Jan 20, 2014

@nikolaybobrovskiy
Copy link
Author

Wow! Thanks a lot!

@Jaex Jaex closed this as completed in 65f0a5e Jan 20, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants