rfc2616

Connection Close for HTTP request response

吃可爱长大的小学妹 提交于 2021-02-10 04:50:56
问题 I have two questions on HTTP Connection close: If a client sends a HTTP request with Connection: close to HTTP Server, Is it the HTTP Server or client responsibility to send TCP FIN after response is received by client? If a client sends a bad formatted HTTP request, and server sends a 400 BAD REQUEST, is it best practice to close the connection by server (even though the HTTP request has connection: keep-alive) or is it good practice to keep the connection still active? Thanks in advance for

Connection Close for HTTP request response

跟風遠走 提交于 2021-02-10 04:50:27
问题 I have two questions on HTTP Connection close: If a client sends a HTTP request with Connection: close to HTTP Server, Is it the HTTP Server or client responsibility to send TCP FIN after response is received by client? If a client sends a bad formatted HTTP request, and server sends a 400 BAD REQUEST, is it best practice to close the connection by server (even though the HTTP request has connection: keep-alive) or is it good practice to keep the connection still active? Thanks in advance for

Connection Close for HTTP request response

此生再无相见时 提交于 2021-02-10 04:47:37
问题 I have two questions on HTTP Connection close: If a client sends a HTTP request with Connection: close to HTTP Server, Is it the HTTP Server or client responsibility to send TCP FIN after response is received by client? If a client sends a bad formatted HTTP request, and server sends a 400 BAD REQUEST, is it best practice to close the connection by server (even though the HTTP request has connection: keep-alive) or is it good practice to keep the connection still active? Thanks in advance for

HTTP/1.1 response to multiple range

自作多情 提交于 2020-01-12 14:23:18
问题 While writing my HTTP/1.1 server, I get stuck dealing multiple ranges request. Section 14.35.1 of RFC 2616 refers some examples but doesn't clarify server behaviour. For instance: GET /some/resource HTTP/1.1 ... Range: bytes=200-400,100-300,500-600 ... Should I return this exact sequence of bytes? Or should I merge all ranges, sending 100-400,500-600 ? Or sending all in between, 100-600 ? Worst, when checking Content-Range response header (Section 14.16), only a single range may be returned,

What is the maximum chunk size in HTTP response with Transfer-Encoding chunked?

霸气de小男生 提交于 2020-01-03 08:45:36
问题 The w3.org (RFC2616) seems not to define a maximum size for chunks. But without a maximum chunk-size there is no space for the chunk-extension. There must be a maximum chunk-size, else I can't ignore the chunk-extension as I'm advised to do if it can't be understood (Quote: "MUST ignore chunk-extension extensions they do not understand" ). 回答1: Each chunk extension must begin with a semi-colon and the list of chunk extensions must end with a CRLF. When parsing the chunk-size, stop at either a

Discriminating between infrastructure and business logic when using HTTP status codes

£可爱£侵袭症+ 提交于 2019-12-30 22:52:44
问题 We are trying to build a REST interface that allows users to test the existence of a specific resource. Let's assume we're selling domain names: the user needs to determine if the domain is available. An HTTP GET combined with 200 and 404 response codes seems sensible at first glance. The problem we have is discriminating between a request successfully served by our lookup service, and a request served under exceptional behaviour from other components. For example: 404 and 200 can be returned

How to specify DELETE method in a link or form?

混江龙づ霸主 提交于 2019-12-30 05:32:09
问题 Rfc2616 lists many methods besides GET and POST, like, say, DELETE, PUT etc. Method field in html forms, though, seems to be allowed to specify only GET or POST. Is it possible to create a link or form in a html page that uses a request method that is not GET or POST? 回答1: You certainly can’t create a link that uses anything other than GET . Since HTML began, links have been meant to be idempotent and free from side effects. For forms and XMLHTTPRequests , Caps’ link is the place to look: Are

Read status line (status code and reason phrase) using AFNetworking's AFHTTPRequestOperation

拟墨画扇 提交于 2019-12-24 10:56:57
问题 I am switching from ASIHTTPRequest to AFNetworking in an iOS application. RF2616 (HTTP/1.1) defines a "status-line" by the combination of "Status Code" and "Reason Phrase". Sometimes the server adds some specific information in this "Reason Phrase" and I found it rather handy that ASIHTTPRequest allowed me to access it easily via ASIHTTPRequest *request = ...; NSString *reason = request.responseStatusMessage; My problem is that I can't find any way to do it with AFHTTPRequestOperation

Node.js pipelining HTTP client agent?

故事扮演 提交于 2019-12-10 15:17:36
问题 The HTTP client built into Node.js doesn't seem to support pipelining requests. However, it occurred to me that it may be possible to create an Agent that sets up pipelining in the background. There may be issues getting the response data back the way it should be, but perhaps the Agent could fake out some socket objects to make the HTTP client work like normal? Has this been done? Alternatively, is there an alternative HTTP client that is a drop-in replacement for the main that supports

What are the uses for If-None-Match with multiple entities?

邮差的信 提交于 2019-12-08 18:35:13
问题 I'm using the ETag header for caching and the browser sends a corresponding If-None-Match header. Initially, I simply compared these headers and it worked. Later it occurred to me that rfc2616 allows a list of entities, so I fixed it. The question is, if the fix gets ever used... Does the browser ever issue a request with an If-None-Match header containing more than one entity? Are there any other real world uses? 回答1: There are two use cases that I can think of: union of browser and caching