Questions tagged [http]

Hypertext Transfer Protocol (HTTP) is an application level network protocol that is used for the transfer of content on the World Wide Web.

HyperText Transfer Protocol (HTTP) uses a client-request/server-response model. The protocol is stateless, which means it does not require the server to retain information or status about each user for the duration of multiple requests. However, for performance reasons and to avoid the connection-latency issues of TCP, techniques like persistent, parallel or pipelined connections may be used.

The request is sent with an HTTP method:

  • HEAD - used to retrieve the GET response header without the actual content (i.e., just the metadata in the content).
  • GET - used to retrieve data, where the request body is ignored.
  • POST - used to send data, contained in the request body, to the server.

These are all the methods supported by older browsers, but the HTTP 1.1 specification includes a few more: PUT, DELETE, TRACE, OPTIONS, CONNECT and PATCH.

The response is returned with a status code:

  • 1xx are informational
  • 2xx indicates success, most pages will have a 200 status
  • 3xx are used for redirections
  • 4xx codes are used for errors with the request, the commonest being 404 for "Page not found"
  • 5xx are used for server errors

Both the request and response are made up of a header and an optional body.

The header contains a list of key-value pairs, separated using new lines and colons. For example, a request may have headers like this:

Proxy-Connection: keep-alive
Referer: URL
User-Agent: browser name or client application
Accept-Encoding: gzip,deflate
Accept-Language: en-GB

Note that in the example the request is telling the server that the response can be sent with the body compressed with either gzip or DEFLATE encoding.

The request needs a body if it is sending additional data to the server, for instance, if sending information entered into a form.

The response headers will include information telling the client how to deal with the response data, for instance, whether they can cache the data (and how long for).

The response body will have the requested data, such as the HTML of a web page or image data.

HTTP is used by browsers to retrieve web content, but can also be used for data APIs, for instance, as a , , or service.

Versions

Resources

Related Tags

61925 questions
22
votes
4 answers

Setting Content-Type in Django HttpResponse object for Shopify App

I'm working on a Shopify app using Django, which I am hosting on a VPS with nginx and gunicorn. I am trying to change the Content-Type of an HttpResponse object to application/liquid, so that I can use Shopify's application proxy feature, but it…
winter
  • 263
  • 1
  • 2
  • 9
22
votes
2 answers

Is there a standard governing the __utma, __utmz etc.. cookies?

Whether I log into Facebook or Twitter, I'll be bombarded with cookies of the such names as: __utma __utmb __utmc __utmv What are their functions ? Is there a standard that governs how these are used on the serverside ?
Jacques René Mesrine
  • 41,077
  • 24
  • 60
  • 99
22
votes
4 answers

How exactly is PHP creating superglobal $_POST, $_GET, $_COOKIE and $_REQUEST?

I'm sorry for confusing title of the question, I'll try to clarify what the issue is. I'm doing some work with Mongrel2 server and I'm writing a PHP handler that has access to raw HTTP request data. Because I have PHP behind Mongrel2, there is no…
Furicane
  • 1,167
  • 6
  • 18
22
votes
3 answers

What exactly does a "persistent connection" mean?

I read about "HTTP persistent connection" but somehow I don't seem to understand what does persistent mean in this context. Could you'll elaborate?
Kevin Boyd
  • 11,251
  • 24
  • 80
  • 125
22
votes
2 answers

I need two instances of AngularJS $http service or what?

I want add a response interceptor to my $http service for error handling purposes. The interceptor logic include send errors messages to server using $http in case necessary, BUT I don't want send errors messages to the server about errors messages,…
user1785721
22
votes
3 answers

Is there a difference between MIME and content type?

While using the f12 tools on ie, when I request a web page, the response header has a content type. Can this also be called MIME type? Or is there a difference?
developer747
  • 13,032
  • 22
  • 78
  • 136
22
votes
7 answers

Getting (415) Unsupported Media Type error

What I have to do is that I have to post JSON data in given URL Where my JSON looks like { "trip_title":"My Hotel Booking", "traveler_info":{ "first_name":"Edward", "middle_name":"", "last_name":"Cullen", …
user1785373
  • 221
  • 1
  • 2
  • 3
22
votes
2 answers

How are PUT parameters passed to a page?

I can't find a precise answer on that question : Are parameters which are sent by PUT passed in the URL, or in the HTTP header ? I think it's the HTTP header, but when I submit my form with the PUT method, it appends the parameters to the URL !
DKF
  • 377
  • 2
  • 4
  • 10
22
votes
0 answers

What does " Mozilla/5.0" in user agent string signify?

I am using $_SERVER['HTTP_USER_AGENT'] to record the user's browser and operating system in use after he logs in my website, when I echo this it shows me these Firefox Mozilla/5.0 (Windows NT 6.1; rv:10.0.2) Gecko/20100101…
Random Guy
  • 2,676
  • 5
  • 17
  • 31
22
votes
1 answer

What is following header for: X-Chrome-Variations?

I was looking at http requests sent by chrome in Fiddler, and I noticed following http header which puzzles me: X-Chrome-Variations: CNa1yQEIjrbJAQiYtskBCKK2yQEIp7bJAQiptskBCLmDygE= This is a base64 encoded 35-byte…
Arsen Zahray
  • 21,834
  • 46
  • 119
  • 205
22
votes
7 answers

HTTP Live Streaming : The Linux nightmare

I'm working on a music VOD app on iPhone, and thanks to Apple guidelines, I have to run a HTTP Live Streaming in order to be accepted on the AppStore. But, since Apple doesn't care about 98% of servers on earth, they don't provide their so magical…
user1432439
22
votes
1 answer

How do I POST an array with multipart/form-data encoding?

In a GET parameter string, or an "x-www-form-urlencoded" POST request, it's possible to specify an array of parameters by naming them with brackets (e.g. "name[]"). Is there a "correct" (or at least a wide-spread convention) way to specify an array…
DougW
  • 25,384
  • 18
  • 76
  • 106
21
votes
3 answers

What is HTTP Status code 000?

Just switched some downloads over to the Akamai CDN network and I'm seeing some strange stuff in the log files they deliver. A number of entries have the status code 000. When I asked them they said that 000 is the status when the client disconnects…
Mitchell V
  • 781
  • 1
  • 5
  • 13
21
votes
2 answers

Sending http request in node.js

I am trying to send a http request to a neo4j database using node.js. This is the code I am using: var options = { host: 'localhost', port: 7474, path: '/db/data', method: 'GET', headers: { accept:…
Oni
  • 736
  • 1
  • 8
  • 16
21
votes
1 answer

Browser caching - Why does IE9 always show http 304 when actually it did not hit the network?

I am trying to set up caching correctly and have set Expires headers to 365 days in the future which is working correctly but not showing correctly in IE9. Does anyone know why? When you visit any website in IE9 (eg www.google.com) then click Enter…
mike nelson
  • 18,814
  • 13
  • 59
  • 66
1 2 3
99
100