VirtualBox

Changeset 75108 in vbox


Ignore:
Timestamp:
Oct 26, 2018 3:44:26 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
126171
Message:

IPRT/http: Extended RTHttpReset with a flag parameter so headers can be kept. bugref:9167

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/http.h

    r74377 r75108  
    5858 *
    5959 * @returns IPRT status code.
    60  * @param   hHttp      Handle to the HTTP interface.
    61  */
    62 RTR3DECL(int) RTHttpReset(RTHTTP hHttp);
     60 * @param   hHttp       Handle to the HTTP interface.
     61 * @param   fFlags      Flags, RTHTTP_RESET_F_XXX.
     62 */
     63RTR3DECL(int) RTHttpReset(RTHTTP hHttp, uint32_t fFlags);
     64
     65/** @name RTHTTP_RESET_F_XXX - Flags for RTHttpReset.
     66 * @{ */
     67/** Keep the headers. */
     68#define RTHTTP_RESET_F_KEEP_HEADERS     RT_BIT_32(0)
     69/** Mask containing the valid flags. */
     70#define RTHTTP_RESET_F_VALID_MASK       UINT32_C(0x00000001)
     71/** @} */
     72
    6373
    6474/**
  • trunk/src/VBox/Runtime/common/rest/RTCRestClientApiBase.cpp

    r74425 r75108  
    178178    {
    179179#if 0   /** @todo XXX: disable for now as it causes the RTHTTP handle state and curl state to get out of sync. */
    180         return RTHttpReset(m_hHttp);
     180        return RTHttpDestroy(m_hHttp, 0 /*fFlags*/);
    181181#else
    182182        RTHttpDestroy(m_hHttp);
  • trunk/src/VBox/Runtime/generic/http-curl.cpp

    r75103 r75108  
    406406
    407407
    408 RTR3DECL(int) RTHttpReset(RTHTTP hHttp)
    409 {
    410     if (hHttp == NIL_RTHTTP)
    411         return VERR_INVALID_HANDLE;
    412 
     408RTR3DECL(int) RTHttpReset(RTHTTP hHttp, uint32_t fFlags)
     409{
     410    /* Validate the instance handle, state and flags. */
    413411    PRTHTTPINTERNAL pThis = hHttp;
    414412    RTHTTP_VALID_RETURN(pThis);
    415 
    416413    AssertReturn(!pThis->fBusy, VERR_WRONG_ORDER);
     414    AssertReturn(!(fFlags & ~RTHTTP_RESET_F_VALID_MASK), VERR_INVALID_FLAGS);
    417415
    418416    /* This resets options, but keeps open connections, cookies, etc. */
    419417    curl_easy_reset(pThis->pCurl);
    420418
    421     rtHttpFreeHeaders(pThis);
     419    if (!(fFlags & RTHTTP_RESET_F_KEEP_HEADERS))
     420        rtHttpFreeHeaders(pThis);
    422421
    423422    pThis->uDownloadHttpStatus      = UINT32_MAX;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette