int BuildRequestString(gfcrequest_t *gfr, char *serializedBuffer) { printf("Building request\n"); char *scheme = SchemeToString(gfr->Scheme); printf("Scheme: %s\n", scheme); char *method = MethodToString(gfr->Method); printf("Method: %s\n", method); char *path = gfr->Path; printf("Path: %s\n", path); char *terminator = "\r\n\r\n"; int spaceSize = 1; int bufferLen = strlen(scheme) + spaceSize + strlen(method) + spaceSize + strlen(path) + spaceSize + strlen(terminator); printf("Buffer length: %d\n", bufferLen); serializedBuffer = realloc(serializedBuffer, (bufferLen + 1) * sizeof(char)); memset(serializedBuffer, '\0', (bufferLen + 1) * sizeof(char)); strcpy(serializedBuffer, scheme); strcat(serializedBuffer, " "); strcat(serializedBuffer, method); strcat(serializedBuffer, " "); strcat(serializedBuffer, path); strcat(serializedBuffer, " "); strcat(serializedBuffer, terminator); printf("Buffer contents: %s\n", serializedBuffer); return bufferLen; }
void LetterChooser::Serialize(PersistentData& storageData) { LetterManager::Serialize(storageData); storageData.SetName("LetterChooser"); storageData.AddVector2Child(mDisplayMin,"DisplayMin"); storageData.AddVector2Child(mDisplayMax,"DisplayMax"); PersistentData* n = new PersistentData("LayoutScheme","LayoutScheme"); storageData.AddChild(n); n->SetProperty("method",MethodToString()); n->SetProperty("jitterStrength",mJitterStrength); n->SetProperty("rows",mRows); }
const QString QHttpRequest::methodString() const { return MethodToString(method()); }
RESPONSE_HEADER_RESULT ResponseHeaderBuilder::Build( String& OutResponse) const { std::stringstream response; response << ProtocolToString(Protocol) << " "; // // Some codes need special cases // if (Code == RESPONSE_MOVED || Code == RESPONSE_FOUND) { if (!RedirectURI.size()) { return RESPONSE_HEADER_NEED_REDIRECT_URI; } response << "URI: " << RedirectURI << HTTP_LINE_ENDING; } else if (Code == RESPONSE_METHOD) { if (!RedirectURI.size()) { return RESPONSE_HEADER_NEED_REDIRECT_URI; } response << "Method: " << MethodToString(Method) << " " << RedirectURI << HTTP_LINE_ENDING; } else { response << Code << " " << ResponseCodeToString(Code) << HTTP_LINE_ENDING; } // // If we require authentication, say as much: // if (Code == RESPONSE_UNAUTHORISED) { if (AuthMode == AUTH_NONE) { return RESPONSE_HEADER_NEED_AUTH_MODE; } if (!AuthRealm.size()) { return RESPONSE_HEADER_NEED_AUTH_REALM; } response << "WWW-Authenticate: " << AuthModeToString(AuthMode) << "Realm=\"" << AuthRealm << "\"" << HTTP_LINE_ENDING; } // // Add the keys // for (auto pair : m_ExtraLines) { response << pair.first << ":"; if (pair.second.size()) response << " " << pair.second; response << HTTP_LINE_ENDING; } // Terminating line break response << HTTP_LINE_ENDING; OutResponse = response.str(); return RESPONSE_HEADER_OK; }