So I am building few mock servers to simulate servers that are involved in actual code.
Since there are few handshakes happening between servers during authentication process, it essentially looks like a ping pong between servers.
Here is how it looks --
Server1 -> Connect api on Server 2
Authorize on Server 1 <- Connect api on Server 2
Authorize on Server 1 -> Calls /Callback Endpoint on Server 1
<- Server 1 sends OK to Server 2(ends handshake with OK)
With this in mind I have following code written to simulate the handshake
# Server 2 (main.py)
#app.get("/v1/connect")
def connect():
httpx.get("server1/authorize")
#app.get("/callback")
def do_callback():
return "OK"
#Server 1 (main.py)
#app.get("/v1/authorize")
def do_authorize():
httpx.get("server1/callback")
But I notice error when I try to start the interactions between Server 1 and 2 by calling Connect endpoint on Server2, Server 1 throws httpcore exception while Server 2 tries to call Server 1's authorize endpoint
Any idea what is wrong here
I am using fastApi to build the mockservers
Related
//How do I send Request in Robot Framework It Gives 500 server error
//This is the request body that I want to send
{
"destinationFaxNumber": "9546599326",
"documentCount": 1
}
*** Variables ***
${base_Url}= https://07du47r041.execute-api.us.com/dev/v1/outbound
*** Test Cases ***
Send Fax Request
${headers}= create dictionary Authorization=${Token} Content-Type=application/json
#${file_data}= Get Binary File D:TestCases/SendFax.json //commented
${body}= create dictionary destinationFaxNumber=9546599326 documentCount=1
create session faxsession ${base_Url} headers=${headers}
log to console ${body}
${response}= Post On Session faxsession /fax data=${body} headers=${headers}
However I'm getting below error
HTTP Error: 500 Server Error: Internal Server Error for url: https://07du47r041.execute-api.us.com/dev/v1/outbound/fax
If postman works and RF does not, the request payload is 99.99% at fault. Capture network traffic with succesful and failing requests and compare what is different.
For example, if you have access to linux box or any machine with netcat, start nc on some port and point the url from postman and rf into that NC socket and see the request differences right in the console of nc.
We have a gRPC server in NodeJs with Nest running on separate port 3001, and when we call this from the Node client it works fine. But one of our microservice is in.NETCore when we try to call it gives us the below error. Currently, we are stuck at the 3,4 point. if someone can guide us it will be very helpful.
1. Status(StatusCode="Unimplemented", Detail="The server does not implement the method", ResponseCode: "404")
2. Status(StatusCode="Internal", Detail="Bad gRPC response. Response protocol downgraded to HTTP/1.1.")
3. An error occurred while sending the request. Http2ConnectionException: The HTTP/2 server sent invalid data on the connection. HTTP/2 error code 'PROTOCOL_ERROR' (0x1).
4. An error occurred while sending the request. IOException: The request was aborted. Http2ConnectionException: The HTTP/2 server sent invalid data on the connection. HTTP/2 error code 'PROTOCOL_ERROR' (0x1).
What we have tried,
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
On startup we use the Kestrel with listening to Http1,
options.ListenLocalhost(5000, o => o.Protocols = HttpProtocols.Http1);
Added HttpClientHandler configuration for certificate and SslProtocols
Is it possible to do a post request from one route in flask to another route? A user sends in data I will look up data then submit that data to another route. Getting Internal Server Error log just has failed (111: Connection refused) while connecting to upstream. I know the route works if i remove the requests line I see found you.
#app.route('/route/<string:uname>', endpoint = 'uname')
def uname():
d={}
d['fname']='data'
d['lname']='data'
requests.post(url='https:site.com/test/', data = data)
return 'found you'
#app.route('test', endpoint = 'test', methods = ['POST','GET'])
def test():
return "submitted to test"
***** Added verify=False to the requests.post line and it just hangs and ties up the service. I have to restart the service for the site to start working.
I've set up an XMPP server using this nodeJS package. I can send a downstream message (from XMPP server to device) just fine, but when I try to send an upstream message the server rarely ever receives it.
The code on the server that handles upstream messages is:
xcs.on('message', function(messageId, from, data, category) {
console.log("Got msg")
console.log(arguments)
});
In android studio I send an upstream message using:
public void send(ArrayList<String> messages) {
System.out.println("Attempting to send");
FirebaseMessaging fm = FirebaseMessaging.getInstance();
System.out.println("msgId: " + msgId.get());
RemoteMessage.Builder rm = new RemoteMessage.Builder(SENDER_ID + "#gcm.googleapis.com")
.setMessageId(Integer.toString(msgId.incrementAndGet()));
for (int i = 0; i < messages.size(); i++) {
rm.addData(String.valueOf(i), messages.get(i));
}
fm.send(rm.build());
}
Using print statements I see that the send function does indeed get invoked and there are no errors when I send but the node server receives nothing. I'll note that the server SOMETIMES receives the upstream messages but its once in nearly 50 tries.
Here's some debugger output that I get when I receive a message from the server then attempt to send back an upstream message:
V/FA: Session started, time: 3115366
I/FA: Tag Manager is not found and thus will not be used
D/FA: Logging event (FE): _s, Bundle[{_o=auto, _sc=MainActivity, _si=8922817241262257215}]
V/FA: Using measurement service
V/FA: Connecting to remote service
D/FA: Connected to remote service
V/FA: Processing queued up service tasks: 1
V/FA: Inactivity, disconnecting from the service
I/System.out: Receieved message:
I/System.out: Key = TYPE, Value = TEXT
I/System.out: Key = ACTION, Value = GET
I/System.out: Attempting to send
I don't know whether the problem is with the android client or the node server. Thanks for any help.
The issue was that I was using AWS Lambda to host the XMPP server thinking that I could turn it only when I need it. The XMPP server needs to be in a server setting (where it can stay on) rather than turned off and on. Details are beyond me.
I am a beginner in node.js. Here is what I am trying to do using express + https.
- node.js https server on port 443
- C client connects to sever
- Mobile client connects to server and does GET
- node.js server sends GET request to C client and sends response back to mobile device
While sending GET request from node.js to C client, I could not get hold of TLS socket instance.
The node.js https documentation says
Class: https.Server#
This class is a subclass of tls.Server and emits events same as http.Server. See
http.Server for more information.
after storing socket
https.on('connection', function(socket) {
global_https_obj[0]=socket;
});
and doing global_https_obj[0].write("DEADBEEF") .. it sends plain text traffic without SSL header and client blocks on SSL_read() [openSSL][ C client does receives GET request but openSSL gives decryption alert and fails to decrypt it ]
It seems TLS socket is accessible through secureConnection event and is not emitted by https.
guys is there any way get hold of TLS socket? or is it possible to add secureConnection event listener in https?