CoAP and suburl - coap

When I put up a resource as for example "SERVER"
and client tries to reach SERVER/something
does it fail to reach the resource? or it reaches SERVER resource and gives extra parameters?
Thank you

If it was a CON request the server responds with a 4.04 (Not Found) ACK Figure 4;
if it was a NON request the server responds with a 4.04 (Not Found) NON Figure 23;

Related

How do I send Request in Robot Framework It Gives 500 server error

//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.

How can i get invalid request message from client in node js http module

As i asked,
I just want to know how to get invalid message from client in nodejs http server.
For example, normally client send "GET / HTTP/1.1\r\n\r\n" to server, But if i sent "VID / HTTP/1.1\r\n\r\n" like this, there is no react in server. I already checked that server computer gets "VID / HTTP/1.1\r\n\r\n" message using wire-shark.
Thank you for your help.
I looked the solution that using 404 response, But It not worked.
look at this server creation code
function server(Route,connect){
console.log("start server function");
function onRequest(req, response) { //req:clientrequest ,response : server response;
console.log("ans server");
Route(req,connect,response,hnd.Hnd);
}
http.createServer(onRequest).listen(port);
}
when I send message "GET /HTTP/1.1\r\n\r\n" from client, server console write "ans server". But not VID
VID is one kind of example that I assume protocol..
#slebetman : Thank you for your solution.
I've voted to close and link it to the appropriate question (see above). Unfortunately, you'll have to modify node in C and compile your own custom node.js. There have been requests for adding an API for this but so far it looks like it's not going anywhere: github.com/joyent/node/issues/3192 and github.com/joyent/http-parser/pull/158 – slebetman

Node.js http GET request takes substantially longer than browser, REST client, et al

I am try to make a simple GET request in Node.js and the request takes 3-5 seconds to resolve whereas the same request in a browser or REST client takes ~400ms. The server to which I am making the request is controlled by our server team, but before I bother them with request/resource monitoring, I was going to ping the community to see if there were any "hey, check this setting first" kind of tips you guys could offer.
The code essentially forwards incoming requests to our server:
http.createServer(function (req, res) {
http.request({
host: "our.private.host",
port: 8080,
path: req.url,
headers: req.headers
}, function () {
res.end("DONE: " + Date.now());
}).end();
}).listen(8001);
I open my browser and type in the following URL:
http://localhost:8001/path/to/some/resource
... which gets forwarded on to the final destination:
http://our.private.host:8080/path/to/some/resource
Everything is working fine and I am getting the response I want, but it takes 3-5 seconds to resolve. If I paste the final destination URL directly in the browser or a REST client, it resolves quickly. I don't know much about our server, unfortunately - but I am looking more for node tips at this point. Note, the request pool isn't maxed out as I am only making 1 request at a time from my local machine.
The first step is gather some info on where the request is taking its time by looking at the exact timing of the network activity on your node server. You can do that by getting a tool that watches all network activity. I personally use Fiddler, but I know that WireShark is popular too.
Once that tools is installed and active, you can then see how long all these various steps in the process of your request are taking:
DNS request to resolve target IP address
Time to connect to the target server
Time to send the http request
Time to receive the http request
Time to send response back to original request
Understanding which of these operations is much longer than expected will give you an idea where to look further for the problem.
FYI, there are pre-built tools such as nginx that can do this type of proxying by just setting some values in a configuration file without any custom coding.

Sails.js Socket Issue on Google App Engine

I'm running Sails.js (v0.11.0) on a Managed VM in Google App Engine, everything works fine provided I disable sockets. I am using the default Sails project, with one model (User) with no custom attributes and am simply visiting the home page in my browser. I see the following in Chrome's console window;
WebSocket connection to 'ws://localhost:8080/socket.io/?__sails_io_sdk_version=0.11.0&__sails_io_sdk_platform=browser&__sails_io_sdk_language=javascript&EIO=3&transport=websocket&sid=GShPZd_tjzqnrigNAAAA' failed: Error during WebSocket handshake: 'Upgrade' header is missing
sails.io.js:143
|> Now connected to Sails.
\___/ For help, see: http://bit.ly/1DmTvgK
(using browser SDK #v0.11.0)
4(index):1 Font from origin 'http://sailsjs.org' has been blocked from loading by Cross-Origin Resource Sharing policy: The 'Access-Control-Allow-Origin' header contains the invalid value ''. Origin 'http://localhost:8080' is therefore not allowed access.
sails.io.js:4 POST http://localhost:8080/socket.io/?__sails_io_sdk_version=0.11.0&__sails_io_s…ascript&EIO=3&transport=polling&t=1427404282042-3&sid=GShPZd_tjzqnrigNAAAA 503 (Service Unavailable)
sails.io.js:143 Failed to connect socket (probably due to failed authorization on server) Error: Error: xhr post error {type: "TransportError", description: 503, stack: (...), message: "xhr post error"}
sails.io.js:143 ====================================
sails.io.js:143 Socket was disconnected from Sails.
sails.io.js:143 Usually, this is due to one of the following reasons:
-> the server was taken down
-> your browser lost internet connectivity
sails.io.js:143 ====================================
sails.io.js:143
Socket is trying to reconnect to Sails...
_-|>_- (attempt #1)
sails.io.js:4 POST http://localhost:8080/socket.io/?__sails_io_sdk_version=0.11.0&__sails_io_s…ascript&EIO=3&transport=polling&t=1427404302073-4&sid=GShPZd_tjzqnrigNAAAA 503 (Service Unavailable)
sails.io.js:4 GET http://localhost:8080/socket.io/?__sails_io_sdk_version=0.11.0&__sails_io_s…sails_io_sdk_language=javascript&EIO=3&transport=polling&t=1427404303080-5 503 (Service Unavailable)
'Upgrade header is missing' seems like it may be the culprit, but I don't understand how the headers could have been changed from whatever Socket.io requires, I have an app.yaml file that simply allows passes all traffic to sails.
#app.yaml
module: default
version: 1
runtime: custom
api_version: 1
vm: true
manual_scaling:
instances: 1
handlers:
- url: /.*
script: app.js
Any help greatly appreciated!
Cheers! R.
I don't think you're going to be able to use Sails' web sockets out of the box. Google App Engine is not something I'm familiar with, but it appears you need to use their API for web sockets. See this example:
https://github.com/thebergamo/appengine-websocket-nodejs
After doing some more poking around I eventually came across this post, which is pretty much a duplicate of this one and should give you some more clues. The short answer is you need to have a separate Google Managed VM running your web socket service and then you access it directly via ip address, which seems to take all the fun out of using Sails.
Run Websocket on GAE

Azure 502 web server received an invalid response while acting as a gateway

I started getting random 502 errors on my page. Is this connected with Azure or my website? I didn't do any changes since Thursday, so I am little skeptical about being my code.
502 - Web server received an invalid response while acting as a gateway or proxy server. There is a problem with the page you are looking for, and it cannot be displayed. When the Web server (while acting as a gateway or proxy) contacted the upstream content server, it received an invalid response from the content server.
I was checking the logs, but all it says is at which url it happens, and it happens on main root page.
In my case this happened because of an infinite loop in the code, which was only triggered in production but not on my local machine. Fixing the infinite loop obviously fixed the 502. ;-)
Update: Meta-example of the infinite loop (C#).
public IList<Model> PropertyOne
{
get
{
return !_productionOnlyCondition ? _models.ToList() : PropertyTwo;
}
}
public IList<Model> PropertyTwo
{
get
{
return PropertyOne.Where(model => model.Condition).ToList();
}
}

Resources