Changeset 87020 in vbox for trunk/src/VBox
- Timestamp:
- Dec 1, 2020 11:26:13 AM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 141612
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/http-server.cpp
r87018 r87020 427 427 428 428 /** 429 * Logs the HTTP protocol communication to the debug logger (2). 430 * 431 * @param pClient Client to log communication for. 432 * @param fWrite Whether the server is writing (to client) or reading (from client). 433 * @param pszData Actual protocol communication data to log. 434 */ 435 static void rtHttpServerLogProto(PRTHTTPSERVERCLIENT pClient, bool fWrite, const char *pszData) 436 { 437 RT_NOREF(pClient); 438 439 if (!pszData) /* Nothing to log? Bail out. */ 440 return; 441 442 char **ppapszStrings; 443 size_t cStrings; 444 int rc2 = RTStrSplit(pszData, strlen(pszData), "\r\n", &ppapszStrings, &cStrings); 445 if (RT_SUCCESS(rc2)) 446 { 447 for (size_t i = 0; i < cStrings; i++) 448 { 449 Log2(("%s %s\n", fWrite ? ">" : "<", ppapszStrings[i])); 450 RTStrFree(ppapszStrings[i]); 451 } 452 453 RTMemFree(ppapszStrings); 454 } 455 } 456 457 /** 458 * Writes HTTP protocol communication data to a connected client. 459 * 460 * @returns VBox status code. 461 * @param pClient Client to write data to. 462 * @param pszData Data to write. Must be zero-terminated. 463 */ 464 static int rtHttpServerWriteProto(PRTHTTPSERVERCLIENT pClient, const char *pszData) 465 { 466 rtHttpServerLogProto(pClient, true /* fWrite */, pszData); 467 return RTTcpWrite(pClient->hSocket, pszData, strlen(pszData)); 468 } 469 470 /** 429 471 * Main function for sending a response back to the client. 430 472 * … … 487 529 rc = RTStrAAppend(&pszHdr, "\r\n"); 488 530 if (RT_SUCCESS(rc)) 489 rc = RTTcpWrite(pClient->hSocket, pszHdr, strlen(pszHdr));531 rc = rtHttpServerWriteProto(pClient, pszHdr); 490 532 } 491 533 … … 982 1024 && cbReadTotal) 983 1025 { 984 LogFlowFunc(("Received request (%zu bytes):\n%s\n\n", cbReadTotal, pszReq)); 1026 LogFlowFunc(("Received client request (%zu bytes)\n", cbReadTotal)); 1027 1028 rtHttpServerLogProto(pClient, false /* fWrite */, szReq); 985 1029 986 1030 rc = rtHttpServerProcessRequest(pClient, szReq, cbReadTotal);
Note:
See TracChangeset
for help on using the changeset viewer.