Changeset 87011 in vbox
- Timestamp:
- Nov 27, 2020 5:33:42 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/http-server.cpp
r87008 r87011 249 249 }; 250 250 251 251 252 /********************************************************************************************************************************* 252 253 * Internal Functions * … … 296 297 *********************************************************************************************************************************/ 297 298 299 /** 300 * Guesses the HTTP MIME type based on a given file extension. 301 * 302 * Note: Has to include the beginning dot, e.g. ".mp3" (see IPRT). 303 * 304 * @returns Guessed MIME type, or "application/octet-stream" if not found. 305 * @param pszFileExt File extension to guess MIME type for. 306 */ 298 307 static const char *rtHttpServerGuessMIMEType(const char *pszFileExt) 299 308 { … … 311 320 } 312 321 322 /** 323 * Allocates and initializes a new client request. 324 * 325 * @returns Pointer to the new client request, or NULL on OOM. 326 * Needs to be free'd with rtHttpServerReqFree(). 327 */ 313 328 static PRTHTTPSERVERREQ rtHttpServerReqAlloc(void) 314 329 { … … 322 337 } 323 338 339 /** 340 * Frees a formerly allocated client request. 341 * 342 * @param pReq Pointer to client request to free. 343 */ 324 344 static void rtHttpServerReqFree(PRTHTTPSERVERREQ pReq) 325 345 { … … 340 360 *********************************************************************************************************************************/ 341 361 362 /** 363 * Main function for sending a response back to the client. 364 * 365 * @returns VBox status code. 366 * @param pClient Client to reply to. 367 * @param enmSts Status code to send. 368 * @param pHdrLst Header list to send. Optional and can be NULL. 369 */ 342 370 static int rtHttpServerSendResponseHdrEx(PRTHTTPSERVERCLIENT pClient, 343 371 RTHTTPSTATUS enmSts, PRTHTTPHEADERLIST pHdrLst) … … 405 433 406 434 /** 407 * Replies with (three digit) response status back to the client .435 * Replies with (three digit) response status back to the client, extended version. 408 436 * 409 437 * @returns VBox status code. … … 419 447 } 420 448 449 /** 450 * Replies with (three digit) response status back to the client. 451 * 452 * @returns VBox status code. 453 * @param pClient Client to reply to. 454 * @param enmSts Status code to send. 455 */ 421 456 static int rtHttpServerSendResponseSimple(PRTHTTPSERVERCLIENT pClient, RTHTTPSTATUS enmSts) 422 457 { … … 424 459 } 425 460 461 /** 462 * Sends a chunk of the response body to the client. 463 * 464 * @returns VBox status code. 465 * @param pClient Client to send body to. 466 * @param pvBuf Data buffer to send. 467 * @param cbBuf Size (in bytes) of data buffer to send. 468 * @param pcbSent Where to store the sent bytes. Optional and can be NULL. 469 */ 426 470 static int rtHttpServerSendResponseBody(PRTHTTPSERVERCLIENT pClient, void *pvBuf, size_t cbBuf, size_t *pcbSent) 427 471 { … … 434 478 } 435 479 480 /** 481 * Resolves a VBox status code to a HTTP status code. 482 * 483 * @returns Resolved HTTP status code, or RTHTTPSTATUS_INTERNALSERVERERROR if not able to resolve. 484 * @param rc VBox status code to resolve. 485 */ 436 486 static RTHTTPSTATUS rtHttpServerRcToStatus(int rc) 437 487 { … … 459 509 *********************************************************************************************************************************/ 460 510 511 /** 512 * Handler for the GET method. 513 * 514 * @returns VBox status code. 515 * @param pClient Client to handle GET method for. 516 * @param pReq Client request to handle. 517 */ 461 518 static DECLCALLBACK(int) rtHttpServerHandleGET(PRTHTTPSERVERCLIENT pClient, PRTHTTPSERVERREQ pReq) 462 519 { … … 543 600 } 544 601 602 /** 603 * Handler for the HEAD method. 604 * 605 * @returns VBox status code. 606 * @param pClient Client to handle HEAD method for. 607 * @param pReq Client request to handle. 608 */ 545 609 static DECLCALLBACK(int) rtHttpServerHandleHEAD(PRTHTTPSERVERCLIENT pClient, PRTHTTPSERVERREQ pReq) 546 610 { … … 625 689 } 626 690 691 /** 692 * Parses headers and fills them into a given header list. 693 * 694 * @returns VBox status code. 695 * @param hList Header list to fill parsed headers in. 696 * @param pszReq Request string with headers to parse. 697 * @param cbReq Size (in bytes) of request string to parse. 698 */ 627 699 static int rtHttpServerParseHeaders(RTHTTPHEADERLIST hList, char *pszReq, size_t cbReq) 628 700 { … … 638 710 } 639 711 712 /** 713 * Main function for parsing and allocating a client request. 714 * 715 * @returns VBox status code. 716 * @param pClient Client to parse request from. 717 * @param pszReq Request string with headers to parse. 718 * @param cbReq Size (in bytes) of request string to parse. 719 * @param ppReq Where to store the allocated client request on success. 720 * Needs to be free'd via rtHttpServerReqFree(). 721 */ 640 722 static int rtHttpServerParseRequest(PRTHTTPSERVERCLIENT pClient, char *pszReq, size_t cbReq, 641 723 PRTHTTPSERVERREQ *ppReq)
Note:
See TracChangeset
for help on using the changeset viewer.