Setting an overall timeout for the whole WinHttp request - winhttp

WinHttp library provides WinHttpSetTimeouts function to set timeouts for different stages of sending/receiving an HTTP request/response. The requirement is to set an overall timeout for the whole process from the time we obtain a session handle, open the request, connect to the server, send the request, and receive the response, etc.
Is there any API or approach to set a timeout for the whole overall stages of sending an HTTP request via WinHttp?

Related

SignalR client not sending updated cookies when calling hub methods

Using JS SingleR client v7.0. Server side is ASP.NET Core V5.0.
When inspecting the server side I get the same cookie value from client for every hub method call equal to that of the cookie value received during the initial connection. This is true even though the cookie value on client has been updated and changed in the time between the connection creation and subsequent method calls to the hub.
If I reestablish the connection, the new cookie does get sent but then again it becomes stale as it is never updated on subsequent hub method calls.
From what I understand WebSockets should send the client cookie every time through it's header but seems to keep providing the old cookie. Is there some setting in SignalR that does some caching on the cookie per connection?
This is by design. The websocket connection is a single request, the connection cannot be updated per invocation because it's not an HTTP request.

Interception of http/https requests in fiddler is not working from Azure Function?

I have an azure function, running locally. it sends out a post request to a remote endpoint that looks something like https://organization-name.somesoftware.com/api/v1.3 it seem to be captured by fiddler but i can not look at the request header or the body payload. I am not sure whether the request is intercepted correctly by fiddler
here is the screenshot from fiddler
The issue is due to Azure Function Execution timeout, by the time fiddler receives and starts debugging the request the Azure Functions gets timeout. You can solve this by increasing the Azure Function time out.
You can check the following document for more information and to increase the timeout.
Azure Function Timeout.
Alternatively, you can try moving to different hosting plan for the Azure Function and also increase the time out at the same time.
Azure Function Premium Plan.
Azure Function Dedicated Plan.

Does SignalR client send the authentication cookie for each hub request

I'm using signalr core and am expect to be sending and receiving messages with the client frequently over mobile, so I've been trimming off the fat to minimize my message sizes. One thing I've simply been curious about is, when making requests from a hub that requires authentication, does every request sent to the hub also sends it's asp.net core authentication cookie, or does the client only send the cookie once when they initiate their connection to the hub and then all subsequent requests no longer need a cookie?
does every request sent to the hub also sends it's asp.net core authentication cookie, or does the client only send the cookie once when they initiate their connection to the hub and then all subsequent requests no longer need a cookie?
The cookies would be sent with the POST [endpoint-base]/negotiate request that is used to establish a connection between the client and the server, like below.
If a connection is established and the WebSockets transport is used, exchanging messages between server and client would be on WebSockets protocol.
If WebSockets is not available, and Long Polling transport is used, while client communicates with hub, cookies are sent with each request.
Besides, as mentioned in this doc: cookie authentication isn't recommended unless the app only needs to authenticate users from the browser client.

Traffic all of restful api Process

I want to know if there's many people request URL on a port (exam. 7000) it will handle on a request in a order, right?
And connect to a database through my API server.
So the client post to my API server through URL: Port and then my API sever connect my database and then return data to client though API server by response JSON Format and next it gonna continue do the same right?
So if it’s in a process others request has to wait until it finish a process that I mention above, right?
Short Answer
No
Server will not wait for the database operation to complete and therefore keep accepting the other request.
The flow of execution will be as follow:
request ──> make database request
request ──> make database request
request ──> make database request
database request complete ──> send response
database request complete ──> send response
database request complete ──> send response
Read this answer for precise and simple explanation.
This is possible because of following concepts and I recommend you to read about it more to understand how Node.js works
Event Loop
Asynchronous Nature of Node.js
Node.js internally use libuv to handle I/O operation.

How does wininet handle cookies

I have a .NET client application that needs to communicate with a server using two distinct user credentials.
Lets say that the application runs two threads. When start running, every thread sends the user & password to authenticate and the server in return stores a cookie on the http session. The subsequent calls send the authentication cookie and not the user credentials.
We have two cookies for the same process. How does wininet "knows" to send the appropriate cookie for each thread?
Does wininet manage the cookies collection per thread? per http session? per process?
Thanks
Wininet uses cookies per process.
However in a .NET client you can use a Cookie container with the HttpWebRequest object.
You create one cookie container for each "session". Assign the appropriate container to each HttpWebRequest when making the various requests for each session.