Discussion:
[Interest] Get the username:password part of a HTTP request from QTcpSocket
Lucas Betschart
2013-12-01 16:11:20 UTC
Permalink
Hi

I have a HTTP-Server based on QTcpServer.

Do you have an idea how I could get the authority part of the HTTP request?
(https://en.wikipedia.org/wiki/URI_scheme#Generic_syntax)
A request might look like this:
http://username:***@127.0.0.1:8462<http://127.0.0.1:8462/>
/method?key=value
Thiago Macieira
2013-12-01 17:36:00 UTC
Permalink
Post by Lucas Betschart
Hi
I have a HTTP-Server based on QTcpServer.
Do you have an idea how I could get the authority part of the HTTP request?
(https://en.wikipedia.org/wiki/URI_scheme#Generic_syntax)
/method?key=value
Konrad Rosenbaum
2013-12-01 20:26:33 UTC
Permalink
Hi,
Post by Lucas Betschart
I have a HTTP-Server based on QTcpServer.
Do you have an idea how I could get the authority part of the HTTP
request? (https://en.wikipedia.org/wiki/URI_scheme#Generic_syntax)
/method?key=value
If you've got the HTTP-Server class from the outside it should provide you
with "authority" information.
Tony Rietwyk
2013-12-02 00:49:39 UTC
Permalink
Hi Konrad / Lucas
-----Original Message-----
Sent: Monday, 2 December 2013 7:27 AM
...
In short: if you do not have the need to access every bit directly use an
existing server implementation and an easier way to communicate with it.
For example Apache has modules for the FCGI and SCGI protocols. In this
case Apache handles the complexities of HTTP while you just have to handle
a significantly simpler protocol.
Konrad
Or keep your existing QTCPServer based code. Then use Apache as the
front-end, and proxy to your backend server. Very straight-forward.

Regards,

Tony
Konrad Rosenbaum
2013-12-02 07:52:10 UTC
Permalink
Hi,
Post by Tony Rietwyk
In short: if you do not have the need to access every bit directly use an
existing server implementation and an easier way to communicate with it.
For example Apache has modules for the FCGI and SCGI protocols. In this
case Apache handles the complexities of HTTP while you just have to
handle a significantly simpler protocol.
Or keep your existing QTCPServer based code. Then use Apache as the
front-end, and proxy to your backend server. Very straight-forward.
I have never tried such a setup, but it sounds like a great idea. Upon reading
the mod_proxy docu a bit I would recommend restricting the configuration as
far as possible, e.g. by forcing Apache to use HTTP 1.0 you avoid the two most
troublesome features (100-continue and chunked encoding).


Konrad

Loading...