httpclient | Simple Go HTTP client with read/write timeout support | TCP library
kandi X-RAY | httpclient Summary
kandi X-RAY | httpclient Summary
Simple Go HTTP client with read/write timeout support.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- DialContext returns a DialContextFn that wraps net . DialContext .
- Default returns an http . Client with default settings
- Read implements the net . Conn interface .
httpclient Key Features
httpclient Examples and Code Snippets
Community Discussions
Trending Discussions on httpclient
QUESTION
I am currently trying to connect to an AWS REST API which requires at least TLS v1.2. The documentation stats that clients must also support cipher suites with perfect forward secrecy (PFS) such as Ephemeral Diffie-Hellman (DHE) or Elliptic Curve Ephemeral Diffie-Hellman (ECDHE).
When sending a GET
request using the HttpClient
, the connection simply times out. I have set the TLS version explicitely to TLSv1.2
like this:
ANSWER
Answered 2022-Mar-30 at 12:52We finally found the reason for this. Windows did not have the required cypher suites enabled. We have used IISCrypto to enable the corresponding cypher suites and all is ok now.
It looks like it's possible to force .NET to TLS 1.2, even though it was not enabled on the server itself.
QUESTION
I am running a Spring Boot app that uses WebClient for both non-blocking and blocking HTTP requests. After the app has run for some time, all outgoing HTTP requests seem to get stuck.
WebClient is used to send requests to multiple hosts, but as an example, here is how it is initialized and used to send requests to Telegram:
WebClientConfig:
...ANSWER
Answered 2021-Dec-20 at 14:25I would propose to take a look in the RateLimiter direction. Maybe it does not work as expected, depending on the number of requests your application does over time. From the Javadoc for Ratelimiter: "It is important to note that the number of permits requested never affects the throttling of the request itself ... but it affects the throttling of the next request. I.e., if an expensive task arrives at an idle RateLimiter, it will be granted immediately, but it is the next request that will experience extra throttling, thus paying for the cost of the expensive task." Also helpful might be this discussion: github or github
I could imaginge there is some throttling adding up or other effect in the RateLimiter, i would try to play around with it and make sure this thing really works the way you want. Alternatively, consider using Spring @Scheduled to read from your queue. You might want to spice it up using embedded JMS for further goodies (message persistence etc).
QUESTION
I am a beginner and I try to create a dynamic pie chart using angular and Kendo UI. I want to get data from json file and it is located inside the assets folder. I tried to link the .ts file and json file. but the chart does not show.
This is my component.html file
...ANSWER
Answered 2022-Feb-01 at 13:23Try to modify the data you pass into tag to be like that
[data]="data?.data"
, as [data]
should be in the form of an array of objects, and your array of objects is the value of the key data
in your json file.
QUESTION
I'm currently writing a .NET 6 application which makes some REST calls.
For some reason, when these calls are made, HttpClient is logging the following:
...ANSWER
Answered 2022-Jan-06 at 16:12Log settings are set in your appsettings.json file (or the appsettings.development.json file):
QUESTION
I have a networking layer that currently uses completion handlers to deliver a result on the operation is complete.
As I support a number of iOS versions, I instead extend the network layer within the app to provide support for Combine. I'd like to extend this to now also a support Async/Await but I am struggling to understand how I can achieve this in a way that allows me to cancel requests.
The basic implementation looks like;
...ANSWER
Answered 2021-Oct-10 at 13:42async/await might not be the proper paradigm if you want cancellation. The reason is that the new structured concurrency support in Swift allows you to write code that looks single-threaded/synchronous, but it fact it's multi-threaded.
Take for example a naive synchronous code:
QUESTION
I use a HttpClient
to communicate with my server as shown below:
ANSWER
Answered 2021-Dec-23 at 15:06This is a long-standing issue #6351 in Xamarin.Android, caused by LetsEncrypt's root expiring and them moving to a new root.
Below is a copy of my post in that issue explaining the situation and the workarounds. See other posts in that thread for details on the workarounds.
Scott Helme has a fantastic write-up of the situation. Go and read that first, then I'll describe how (I think) this applies to xamarin-android.
I'm going to copy the key diagram from that article (source):
The red chain is what used to happen: the IdenTrust DST Root CA X3 is an old root certificate which is trusted pretty much everywhere, including on Android devices from 2.3.6 onwards. This is what LetsEncrypt used to use as their root, and it meant that everyone trusted them. However, this IdenTrust DST Root CA X3 recently expired, which means that a bunch of devices won't trust anything signed by it. LetsEncrypt needed to move to their own root certificate.
The blue chain is the ideal new one -- the ISRG Root X1 is LetsEncrypt's own root certificate, which is included on Android 7.1.1+. Android devices >= 7.1.1 will trust certificates which have been signed by this ISRG Root X1.
However, the problem is that old pre-7.1.1 Android devices don't know about ISRG Root X1, and don't trust this.
The workaround which LetsEncrypt is using is that old Android devices don't check whether the root certificate has expired. They therefore by default serve a chain which includes LetsEncrypt's root ISRG Root X1 certificate (which up-to-date devices trust), but also include a signature from that now-expired IdenTrust DST Root CA X3. This means that old Android devices trust the chain (as they trust the IdenTrust DST Root CA X3, and don't check whether it's expired), and newer devices also trust the chain (as they're able to work out that even though the root of the chain has expired, they still trust that middle ISRG Root X1 certificate as a valid root in its own right, and therefore trust it).
This is the green path, the one which LetsEncrypt currently serves by default.
However, the BoringSSL library used by xamarin-android isn't Android's SSL library. It 1) Doesn't trust the IdenTrust DST Root CA X3 because it's expired, and 2) Isn't smart enough to figure out that it does trust the ISRG Root X1 which is also in the chain. So if you serve the green chain in the image above, it doesn't trust it. Gack.
The options therefore are:
- Don't use BoringSSL and do use Android's SSL library. This means that xamarin-android behaves the same as other Android apps, and trusts the expired root. This is done by using
AndroidClientHandler
as described previously. This should fix Android >= 2.3.6. - Do use BoringSSL but remove the expired IdenTrust DST Root CA X3 from Android's trust store ("Digital Signature Trust Co. - DST Root CA X3" in the settings). This tricks BoringSSL into stopping its chain at the ISRG Root X1, which it trusts (on Android 7.1.1+). However this will only work on Android devices which trust the ISRG Root X1, which is 7.1.1+.
- Do use BoringSSL, and change your server to serve a chain which roots in the ISRG Root X1, rather than the expired IdenTrust DST Root CA X3 (the blue chain in the image above), using
--preferred-chain "ISRG Root X1"
. This means that BoringSSL ignores the IdenTrust DST Root CA X3 entirely, and roots to the ISRG Root X1. This again will only work on Android devices which trust the ISRG Root X1, i.e. 7.1.1+. - Do the same as 3, but by manually editing fullchain.pem.
- Use another CA such as ZeroSSL, which uses a root which is trusted back to Android 2.2, and which won't expire until 2038.
QUESTION
I have the following Dockerfile
:
ANSWER
Answered 2021-Dec-05 at 23:05Does it make sense to iterate through layers like this and keep adding files (to some target, does not matter for now) and deleting the added files in case they are found with a .wh prefix? Or am I totally off and is there a much better way?
There is a much better way, you do not want to reimplement (with worse performances) what Docker already does. The main reason is that Docker uses a mount filesystem called overlay2
by default that allows the creation of images and containers leveraging the concepts of a Union Filesystem: lowerdir
, upperdir
, workdir
and mergeddir
.
What you might not expect is that you can reproduce an image or container building process using the mount
command available in almost any Unix-like machine.
I found a very interesting article that explains how the overlay storage system works and how Docker internally uses it, I highly recommend the reading.
Actually, if you have read the article, the solution is there: you can mount
the image data you have by docker inspect
ing its LowerDir
, UpperDir
, WorkDir
and by setting the merged dir to a custom path. To make the process simpler, you can run a script like:
QUESTION
What is the preferred way to make a VS connected service (NSwag) injected into classes/controllers. I have found a lot of suggestions on the net to use this form:
...ANSWER
Answered 2021-Sep-26 at 13:24Ok, I actually solved this problem by poking around through OpenApiReference
, but it requires manual modification of csproj file. Additional Options
node has to be added to OpenApiReference
item group, to instruct NSwag to NOT expose BaseUrl and to also generate an interface, which eases the work with setting up DI without additional code.
Visual Studio team should really add these two checkboxes to Connected Services screens/configuration for OpenAPI.
QUESTION
We are building a mobile app for iOS and Android using Xamarin Forms 5 and using Visual Studio 2022. When we make a Post request to any api, both our own as external api's we are always returned:
Xamarin.PreBuilt.iOS[3728:2199180] Xamarin.iOS: Received unhandled ObjectiveC exception: NSMallocException Failed to grow buffer
GET request work fine. I have searched Google and StackOverflow but can not find any help. I have tried to increase the HttpClient.MaxResponseContentBufferSize without any difference.
The app for now is very simple, one page with a button to test. Code behind is as followed:
...ANSWER
Answered 2021-Dec-01 at 09:02I've had exactly the same problem, and have logged a ticket with Microsoft on the VS feedback forums. And then today I found a simple work-around. At least I assume it's a work-around and not a solution. Where I had
QUESTION
I am using Angular Capacitor v3 with axios. Receiving a Network Error when making any request to any external server. This is only occurring while emulating with XCode. The request never reaches the server, just returns immediately with status 0.
I cannot repeat this problem locally on Windows, or published website, or Android Studio emulators, or published to android device.
Not sure if I am missing a permission or configuration, but I have tried adding "Local Network Usage", "Location Always and When In Use" permissions and played around with NSAppTransportSecurity settings to the Info.plist.
I do not believe its an issue with the server since it seems like it never even reaches it. But I have a verified HTTPS certificate, hosted by Azure, with valid CORS rules.
I have also tried HttpClient with Angular, same result.
The error occurs immediately and does not give specific information but here is the message:
...{"headers":{"normalizedNames":{},"lazyUpdate":null,"headers":{}},"status":0,"statusText":"Unknown Error","url":"https://jsonplaceholder.typicode.com/users/1","ok":false,"name":"HttpErrorResponse","message":"Http failure response for https://jsonplaceholder.typicode.com/users/1: 0 Unknown Error","error":{"isTrusted":true}}
ANSWER
Answered 2021-Oct-13 at 08:01I am just facing same issue It was working on different domain, no hostname is different and it stopped working. So it doesn't even make a request to a server. Also same configuration works on android. just not IOS
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install httpclient
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page