using HTTP/1.0 proxy server for browser - http

I am writing http proxy server with support http/1.0. I use my proxy server in browser (google chrome). Proxy gets request something like GET www.site.com HTTP/1.1 and sends response HTTP/1.0 505 HTTP Version Not Supported. After that browser show me that error. However I expect that browser will make re-request with http/1.0 version (for example GET www.site.com HTTP/1.0). Whether I should send another response in order to get desired behaviour from browser? or it isn't possible? How to make the browser to work with http/1.0 proxy-server?

I guess, this depends on your browser. If you use Microsoft Internet Explorer, this might help: http://support.microsoft.com/kb/811262/EN-US
I haven't found anything about http protocol negotiation. A client could issue a "HTTP OPTIONS" request in order to detect the server's abilities, but there is no such requirement from the RFC 2616, Section 19.6. There's only an expectation for clients to understand lower protocol versions.

Related

How to test HTTP/2 implementation on non-supporting browser?

To implement HTTP/2 support on nginx/1.11.1, I'm going to redirect all HTTP Request to HTTPS.
In this case, how will Bot and Browsers, that don't support HTTP/2 protocol, behave and render the page?
Is there a way for me to simulate HTTP/1.1 browser behavior on Chrome Developer Tools?
You are mixing two concepts here that are somehow related, but they are largely different: HTTP to HTTPs redirect, and HTTP 1.1 vs HTTP/2 negotiation.
Redirecting HTTP to HTTPS requests is fine. Virtually every client (browser, bot, etc) available these days is capable of understanding HTTPS requests.
As for HTTP 1.1 vs HTTP/2, Nginx will fallback to HTTP 1.1 if the HTTP/2 connection fails because the client doesn't support it.
Last but not least, this question has very little to do with StackOverflow. It is more appropriate in ServerFault or SuperUser.
Potentially interesting
TCP retransmission will increase. This could lead on poorly configured devices for connection abort.

Which changes do a browser make when using an HTTP Proxy?

Imagine a webbrowser that makes an HTTP request to a remote server, such as site.example.com
If the browser is then configured to use a proxy server, let's call it proxy.example.com using port 8080, in which ways are the request now different?
Obviously the request is now sent to proxy.example.com:8080, but there must surely be other changes to enable the proxy to make a request to the original url?
RFC 7230 - Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing, Section 5.3.2. absolute-form:
When making a request to a proxy, other than a CONNECT or server-wide
OPTIONS request (as detailed below), a client MUST send the target
URI in absolute-form as the request-target.
absolute-form = absolute-URI
The proxy is requested to either service that request from a valid
cache, if possible, or make the same request on the client's behalf
to either the next inbound proxy server or directly to the origin
server indicated by the request-target. Requirements on such
"forwarding" of messages are defined in Section 5.7.
An example absolute-form of request-line would be:
GET http://www.example.org/pub/WWW/TheProject.html HTTP/1.1
So, without proxy, the connection is made to www.example.org:80:
GET /pub/WWW/TheProject.html HTTP/1.1
Host: www.example.org
With proxy it is made to proxy.example.com:8080:
GET http://www.example.org/pub/WWW/TheProject.html HTTP/1.1
Host: www.example.org
Where in the latter case the Host header is optional (for HTTP/1.0 clients), and must be recalculated by the proxy anyway.
The proxy simply makes the request on behalf of the original client. Hence the name "proxy", the same meaning as in legalese. The browser sends their request to the proxy, the proxy makes a request to the requested server (or not, depending on whether the proxy wants to forward this request or deny it), the server returns a response to the proxy, the proxy returns the response to the original client. There's no fundamental difference in what the server will see, except for the fact that the originating client will appear to be the proxy server. The proxy may or may not alter the request, and it may or may not cache it; meaning the server may not receive a request at all if the proxy decides to deliver a cached version instead.

What are the consequences of not setting "cache-control" in http response header?

Say, my web application responds to a http request with a response that has no "cache-control" in its header. If the client-end submits the same request within a relatively short time, what would happen? Does a cached copy of the response get used and thus the request does not need to reach the server? Or does the request get sent to the server just like the first time?
If the answer is "it depends", please indicate what the dependencies are. Thanks.
There is no caching behavior defined in HTTP/1.1 protocol for a resource served with no cache-related headers, so it's really up to the HTTP client's implementation.
Here is the link to RFC.

What HTTP request headers are important/commonly used?

I'm writing a web server, and I'd like to know what HTTP request headers (sent by the client) are the most common and thus that I should focus on implementing.
Right now, I only support Accept and Host.
Not sure on your scope but since you are interested in serving web browsers, you should have a look into the RFC (HTTP 1.1)
Read about what the server MUST process
The Cookie header might be a good idea, as would the Content-Length header; without Content-Length you won't be able to handle POST and PUT requests properly.

HTTP Version problem POSTing XML messages to a server

I have a DLL library, which I have no control over, that builds a XML message and sends it over HTTP to a web server. Due to the strict specifications, the server will only accept message with POST HTTP/1.1. However, the logs in the server shows receiving messages being POSTed HTTP/1.0. If I open the URL directly into a browser, the log shows GET HTTP/1.1, which is correct. We're not going through a proxy and the gateway isn't changing the version from what I can tell. I've tried on two different networks and I get the same error. Also, I have tried on Windows Server 2003 and Windows XP Pro, both of which should support HTTP 1.1.
Does anyone have any ideas why the server is receiving HTTP/1.0 using a POST, but using a GET shows HTTP/1.1?
Edit:
I've contacted the DLL maker about this, but their help isn't that great.
Edit 2:
Using Fiddler, I was able to extract the header, which is posted below. As you can see it's using HTTP/1.0.
POST /48A548C0BA8211DEA1EEE5AF2B3D5823;48A548C1BA8211DEA1EE8EF735B81699/
SJzWLaVEESCESCX6ESCESCW~ESC6FESCwxEuESCESCAb,L7ESCecvESCuESCESCrBESCHpESC3
ESCESCJw_ESCESClrj,ESC_4xESCOQpLwyRJGgp6p3YDG!uvXESCESC6!wVxESC7.dESCcTvmG5WM HTTP/1.0
Content-Type: application/xml;charset="utf-8"
Host: ***
Content-Length: 787
Sounds like you're out of luck seeing as you can't change the DLL. According to your response above in the comments, it seems like the DLL you're using is using HTTP/1.0 to send the HTTP requests to the server.
This is as good an answer as I can provide you with, given that you did not specify which DLL you are talking about or provided additional details.
I would suggest you to take a closer look at the DLL you're using to see if it is possible to instruct that library to use HTTP/1.1 for the requests it's sending out.
Good luck.
Write a server that acts a proxy, accepts http/1.0 obviousy, and then forwards to the destination server. This could work if you only have destination server. Otherwise get in touch with the vendor...... or perhaps take up reverse engineering as a side hobby.
Also on fiddler you should see the request and and response. You can correctly configure fiddler2 with any httpclient (besides just IE) using this reference: http://www.fiddler2.com/fiddler/help/hookup.asp

Resources