Ejemplo n.º 1
0
void wxsItemEditor::OnButton(wxCommandEvent& event)
{
    wxWindow* Btn = (wxWindow*)event.GetEventObject();
    if ( Btn )
    {
        InsertRequest(Btn->GetName());
    }
}
//*****************************************************************************
//
//! Set the HTTP message type.
//!
//! \param pcDest is a pointer to the destination/output string.
//! \param ui8Type is the HTTP request type.  Macros such as HTTP_MESSAGE_GET
//! are defined in http.h.
//! \param pcResource is a pointer to a string containing the resource portion
//! of the HTTP message.  The resource goes in between the type  (ex: GET) and
//! HTTP suffix on the first line of a HTTP request.  An example would be
//! index.html.
//!
//! This function should be called to start off a new HTTP request.
//!
//! \return None.
//
//*****************************************************************************
void
HTTPMessageTypeSet(char *pcDest, uint8_t ui8Type, char *pcResource)
{
    //
    // Check to see if the resource and destination pointers are the same.  If
    // yes, insert the request type at the beginning of the resource string.
    //
    if(pcDest == pcResource)
    {
        //
        // Add the request type to the buffer.
        //
        switch(ui8Type)
        {
            case HTTP_MESSAGE_CONNECT:
            {
                InsertRequest(pcDest, g_pcHttpConnect);
                break;
            }
            case HTTP_MESSAGE_GET:
            {
                InsertRequest(pcDest, g_pcHttpGet);
                break;
            }
            case HTTP_MESSAGE_POST:
            {
                InsertRequest(pcDest, g_pcHttpPost);
                break;
            }
            case HTTP_MESSAGE_PUT:
            {
                InsertRequest(pcDest, g_pcHttpPut);
                break;
            }
            case HTTP_MESSAGE_DELETE:
            {
                InsertRequest(pcDest, g_pcHttpDelete);
                break;
            }
            case HTTP_MESSAGE_HEAD:
            {
                InsertRequest(pcDest, g_pcHttpHead);
                break;
            }
            case HTTP_MESSAGE_TRACE:
            {
                InsertRequest(pcDest, g_pcHttpTrace);
                break;
            }
            case HTTP_MESSAGE_OPTIONS:
            {
                InsertRequest(pcDest, g_pcHttpOptions);
                break;
            }
            case HTTP_MESSAGE_PATCH:
            {
                InsertRequest(pcDest, g_pcHttpPatch);
                break;
            }
        }
    }
    else
    {
        //
        // Add the request type to the buffer.
        //
        switch(ui8Type)
        {
            case HTTP_MESSAGE_CONNECT:
            {
                usprintf(pcDest, g_pcHttpConnect);
                break;
            }
            case HTTP_MESSAGE_GET:
            {
                usprintf(pcDest, g_pcHttpGet);
                break;
            }
            case HTTP_MESSAGE_POST:
            {
                usprintf(pcDest, g_pcHttpPost);
                break;
            }
            case HTTP_MESSAGE_PUT:
            {
                usprintf(pcDest, g_pcHttpPut);
                break;
            }
            case HTTP_MESSAGE_DELETE:
            {
                usprintf(pcDest, g_pcHttpDelete);
                break;
            }
            case HTTP_MESSAGE_HEAD:
            {
                usprintf(pcDest, g_pcHttpHead);
                break;
            }
            case HTTP_MESSAGE_TRACE:
            {
                usprintf(pcDest, g_pcHttpTrace);
                break;
            }
            case HTTP_MESSAGE_OPTIONS:
            {
                usprintf(pcDest, g_pcHttpOptions);
                break;
            }
            case HTTP_MESSAGE_PATCH:
            {
                usprintf(pcDest, g_pcHttpPatch);
                break;
            }
        }

        //
        // Add the resource to the buffer.
        //
        strcat(pcDest, pcResource);
    }

    //
    // Finish the first "line" by adding the HTTP suffix.
    //
#ifdef USE_HTTP_1_0
    strcat(pcDest, g_pcSuffixHttp10);
#else
    strcat(pcDest, g_pcSuffixHttp11);
#endif
}