3

I am using Qt5 QNetworkAccessManager to create an HTTP request. However I want to be able to connect to a unix socket instead of a http://hostname:port/. I investigated some workarounds for this problem, and tried inheriting QNetworkAccessManager, and override the createRequest virtual method, but the problem is that most of the logic for postProcess is inside the QNetworkReplyHttpImpl derived class which is fairly huge.

I have some requirements

  • avoid touching the Qt5 SDK
  • avoid copying too much code from the QNetworkReplyHttpImpl and implement bare bones QNetworkReply abstract class and to use the QLocalSocket.
  • qhttpclient seems like an option but it will not glue nicely with the rest of the Qt5 classes, or rather I would need some more glue logic to fit with the rest of my application.

Any suggestions?

3
  • 1
    A question with a similar wish: HTTP over AF_UNIX: HTTP connection to unix socket Commented Oct 30, 2018 at 11:52
  • 1
    Thanks, I have solved it though by subclassing QNetworkAccessManager and QNetworkReply Commented Nov 16, 2018 at 18:00
  • Is your subclass to big for sharing? I was thinking into opening a local TCP socket (with QTcpServer) and then proxying it to a QLocalSocket Commented May 14, 2020 at 15:04

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.