MCPcopy Create free account
hub / github.com/KikoPlayProject/KikoPlay / writeHeaders

Method writeHeaders

LANServer/httpserver/httpresponse.cpp:48–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

46}
47
48void HttpResponse::writeHeaders()
49{
50 Q_ASSERT(sentHeaders==false);
51 QByteArray buffer;
52 buffer.append("HTTP/1.1 ");
53 buffer.append(QByteArray::number(statusCode));
54 buffer.append(' ');
55 buffer.append(statusText);
56 buffer.append("\r\n");
57 foreach(QByteArray name, headers.keys())
58 {
59 buffer.append(name);
60 buffer.append(": ");
61 buffer.append(headers.value(name));
62 buffer.append("\r\n");
63 }
64 foreach(HttpCookie cookie,cookies.values())
65 {
66 buffer.append("Set-Cookie: ");
67 buffer.append(cookie.toByteArray());
68 buffer.append("\r\n");
69 }
70 buffer.append("\r\n");
71 writeToSocket(buffer);
72 socket->flush();
73 sentHeaders=true;
74}
75
76bool HttpResponse::writeToSocket(QByteArray data)
77{

Callers

nothing calls this directly

Calls 2

appendMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected