http
Why does my web server software disallow PUT and DELETE requests?
Often web servers will be configured to block anything except GET and POST since 99% of the time they’re all that are needed and there have been problems in the past with applications assuming the requests were one of those two. You don’t say which server it is but, for example, you can tell Apache … Read more
Encrypt IDs in URL variables
oh ok, so for sensitive information best to use sessions then, are table Ids etc safe to throw in the GET var? Yes, sensitive information must not leave your server in the first place. Use sessions. As for “are table ids safe in the URL”: I don’t know, is there anything bad a user could … Read more
How to make external HTTP requests with Node.js [closed]
NodeJS supports http.request as a standard module: http://nodejs.org/docs/v0.4.11/api/http.html#http.request var http = require(‘http’); var options = { host: ‘example.com’, port: 80, path: ‘/foo.html’ }; http.get(options, function(resp){ resp.on(‘data’, function(chunk){ //do something with chunk }); }).on(“error”, function(e){ console.log(“Got error: ” + e.message); });
How to redirect user’s browser URL to a different page in Nodejs?
To effect a redirect, you send a redirect status (301 for permanent redirect, 302 for a “this currently lives on …” redirect, and 307 for an intentional temporary redirect): response.writeHead(301, { Location: `http://whateverhostthiswillbe:8675/${newRoom}` }).end();
How can I get the clients IP address from HTTP headers?
In addition to REMOTE_ADDR and HTTP_X_FORWARDED_FOR there are some other headers that can be set such as: HTTP_CLIENT_IP HTTP_X_FORWARDED_FOR can be comma delimited list of IPs HTTP_X_FORWARDED HTTP_X_CLUSTER_CLIENT_IP HTTP_FORWARDED_FOR HTTP_FORWARDED I found the code on the following site useful: http://www.grantburton.com/?p=97
HTTP Range header
As Wrikken suggested, it’s a valid request. It’s also quite common when the client is requesting media or resuming a download. A client will often test to see if the server handles ranged requests other than just looking for an Accept-Ranges response. Chrome always sends a Range: bytes=0- with its first GET request for a … Read more
What should a Multipart HTTP request with multiple files look like? [duplicate]
Well, note that the request contains binary data, so I’m not posting the request as such – instead, I’ve converted every non-printable-ascii character into a dot (“.”). POST /cgi-bin/qtest HTTP/1.1 Host: aram User-Agent: Mozilla/5.0 Gecko/2009042316 Firefox/3.0.10 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Connection: keep-alive Referer: http://aram/~martind/banner.htm Content-Type: multipart/form-data; boundary=2a8ae6ad-f4ad-4d9a-a92c-6d217011fe0f Content-Length: 514 … Read more
Sample http range request session
The following exchange is between Chrome and a static web server, retrieving an MP4 video. Initial request – for the video. Note the Accept-Ranges response header to indicate the server has range header support: GET /BigBuckBunny_320x180.mp4 Cache-Control: max-age=0 Connection: keep-alive Accept-Language: en-GB,en-US,en Host: localhost:8080 Range: Accept: text/html,application/xhtml+xml,application/xml,*/* User-Agent: Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.7 … Accept-Encoding: … Read more
Angular2 http.get() ,map(), subscribe() and observable pattern – basic understanding
Here is where you went wrong: this.result = http.get(‘friends.json’) .map(response => response.json()) .subscribe(result => this.result =result.json()); it should be: http.get(‘friends.json’) .map(response => response.json()) .subscribe(result => this.result =result); or http.get(‘friends.json’) .subscribe(result => this.result =result.json()); You have made two mistakes: 1- You assigned the observable itself to this.result. When you actually wanted to assign the list of … Read more