[Interest] Get the username:password part of a HTTP request from QTcpSocket

Thiago Macieira thiago.macieira at intel.com
Sun Dec 1 18:36:00 CET 2013


On domingo, 1 de dezembro de 2013 17:11:20, Lucas Betschart wrote:
> 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:password@127.0.0.1:8462<http://127.0.0.1:8462/>
> /method?key=value
> 
> >From the incomming QTcpSocket I can only get the IP, the port number and
> 
> the data (which includes the query string for HTTP but not the
> authentication part). How can I get the rest of the request?

They're part of the HTTP headers that you received. Take a look at RFC 2616. 
You're looking for the Host and Authorization headers.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20131201/b40735b8/attachment.sig>


More information about the Interest mailing list