Hi, On Sunday 01 December 2013, Lucas Betschart wrote: > 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
If you've got the HTTP-Server class from the outside it should provide you with "authority" information. > 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? On the other hand if you are trying to implement HTTP with only limited knowledge about the protocol: I strongly suggest you look for alternative options - HTTP is trickier than it looks at first. To name just a few pitfalls that I have encountered with this: * you have to support 2 radically different protocols: HTTP 0.9 and 1.x * the latter has 2 dialects: HTTP 1.0 and 1.1 which differ in some key details * there may be a radically different 3rd protocol soon: HTTP 2.0 * in HTTP 1.1 clients can state (POST) requests outright or they can ask nicely first - the 100-continue feature * some clients use the streaming feature (chunked encoding) without reason or rhyme (Microsoft's SOAP implementations are particularly bad) 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
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest