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

Proxy server not supported #83

Open
MichelDaoust opened this issue Jan 31, 2018 · 4 comments
Open

Proxy server not supported #83

MichelDaoust opened this issue Jan 31, 2018 · 4 comments
Assignees

Comments

@MichelDaoust
Copy link

MichelDaoust commented Jan 31, 2018

Hi,
Thank you for you API but ...

Should return a good error (Proxy authentication) or better : Allow passing proxy info in the API. Now, the exception is a JSON token error, not really helpful.

Thank you.

@roeeba roeeba self-assigned this Feb 4, 2018
@roeeba roeeba added the question label Feb 4, 2018
@roeeba
Copy link
Contributor

roeeba commented Feb 4, 2018

Hi @MichelDaoust. Could you please share some more information? what exactly do you expect to achieve and what's the exact issue you're currently facing (a reference to the code and a full error stacktrace would be very appreciated). Thanks!

@MichelDaoust
Copy link
Author

Hi @roeeba ,
I want to upload an image to Cloudinary.

In project CloudinaryDotNet.Core.csproj

If you look the result of the response in Api.Parse returned when you upload a file (from the CallAndParse function) you receive this HTTP reponse :

{StatusCode: 407, ReasonPhrase: 'authenticationrequired', Version: 1.1, Content: System.Net.Http.NoWriteNoSeekStreamContent, Headers:\r\n{\r\n Cache-Control: no-cache\r\n Date: Mon, 05 Feb 2018 20:16:14 GMT\r\n Proxy-Authenticate: NTLM\r\n Proxy-Authenticate: Basic realm="xxxxxxxx.com"\r\n Proxy-Connection: Keep-Alive\r\n Content-Length: 4076\r\n Content-Type: text/html\r\n}}
Content [HttpContent]:{System.Net.Http.NoWriteNoSeekStreamContent}

So look the authenticationrequired and there is not valid JSON in the body.

So the result is when you get the JSON object from the response, you have this exception (because your HTTP response is now how you expect it) :

fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[0]
An unhandled exception has occurred while executing the request
Newtonsoft.Json.JsonReaderException: Error reading JToken from JsonReader. Path '', line 0, position 0.
at Newtonsoft.Json.Linq.JToken.ReadFrom(JsonReader reader, JsonLoadSettings settings)
at Newtonsoft.Json.Linq.JToken.Parse(String json, JsonLoadSettings settings)
at CloudinaryDotNet.Api.Parse[T](Object response)
at CloudinaryDotNet.Api.CallAndParse[T](HttpMethod method, String url, SortedDictionary2 parameters, FileDescription file, Dictionary2 extraHeaders)
at CloudinaryDotNet.Cloudinary.Upload(ImageUploadParams parameters)
at DatingApp.API.Controllers.PhotosController.d__6.MoveNext() in C:\Users\michel.daoust\Documents\Demo\DatingApp\DatingApp.API\Controllers\PhotosController.cs:line 75
....
....

thank you.

@roeeba
Copy link
Contributor

roeeba commented Mar 13, 2018

Hi @MichelDaoust, thank you very much for sharing the details and apologize for not responding earlier. I've opened a ticket with our dev team. We'll do our best to address this issue as soon as we can.

@roeeba roeeba removed their assignment Mar 13, 2018
@roeeba
Copy link
Contributor

roeeba commented Feb 21, 2019

Hi @MichelDaoust. While it's still on our roadmap to support this in-house, you may find the following solution helpful - https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/network/defaultproxy-element-network-settings

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

3 participants