本文整理汇总了C++中HTTPHeaderMap::end方法的典型用法代码示例。如果您正苦于以下问题:C++ HTTPHeaderMap::end方法的具体用法?C++ HTTPHeaderMap::end怎么用?C++ HTTPHeaderMap::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTTPHeaderMap
的用法示例。
在下文中一共展示了HTTPHeaderMap::end方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: populateHeadersObject
static void populateHeadersObject(ScriptObject* object, const HTTPHeaderMap& headers)
{
HTTPHeaderMap::const_iterator end = headers.end();
for (HTTPHeaderMap::const_iterator it = headers.begin(); it != end; ++it) {
object->set(it->first.string(), it->second);
}
}
示例2: processHeaders
bool WebSocketHandshake::processHeaders(const HTTPHeaderMap& headers)
{
for (HTTPHeaderMap::const_iterator it = headers.begin(); it != headers.end(); ++it) {
switch (m_mode) {
case Normal:
if (it->first == "websocket-origin")
m_wsOrigin = it->second;
else if (it->first == "websocket-location")
m_wsLocation = it->second;
else if (it->first == "websocket-protocol")
m_wsProtocol = it->second;
else if (it->first == "set-cookie")
m_setCookie = it->second;
else if (it->first == "set-cookie2")
m_setCookie2 = it->second;
continue;
case Incomplete:
case Failed:
case Connected:
ASSERT_NOT_REACHED();
}
ASSERT_NOT_REACHED();
}
return true;
}
示例3: addHeaders
void CurlDownload::addHeaders(const ResourceRequest& request)
{
if (request.httpHeaderFields().size() > 0) {
struct curl_slist* headers = 0;
HTTPHeaderMap customHeaders = request.httpHeaderFields();
HTTPHeaderMap::const_iterator end = customHeaders.end();
for (HTTPHeaderMap::const_iterator it = customHeaders.begin(); it != end; ++it) {
const String& value = it->value;
String headerString(it->key);
if (value.isEmpty())
// Insert the ; to tell curl that this header has an empty value.
headerString.append(";");
else {
headerString.append(": ");
headerString.append(value);
}
CString headerLatin1 = headerString.latin1();
headers = curl_slist_append(headers, headerLatin1.data());
}
if (headers) {
curl_easy_setopt(m_curlHandle, CURLOPT_HTTPHEADER, headers);
m_customHeaders = headers;
}
}
}
示例4: decodePlatformData
bool ArgumentCoder<ResourceResponse>::decode(ArgumentDecoder* decoder, ResourceResponse& resourceResponse)
{
if (kShouldSerializeWebCoreData) {
bool responseIsNull;
if (!decoder->decode(responseIsNull))
return false;
if (responseIsNull) {
resourceResponse = ResourceResponse();
return true;
}
ResourceResponse response;
String url;
if (!decoder->decode(url))
return false;
response.setURL(KURL(KURL(), url));
int32_t httpStatusCode;
if (!decoder->decode(httpStatusCode))
return false;
response.setHTTPStatusCode(httpStatusCode);
HTTPHeaderMap headers;
if (!decoder->decode(headers))
return false;
for (HTTPHeaderMap::const_iterator it = headers.begin(), end = headers.end(); it != end; ++it)
response.setHTTPHeaderField(it->key, it->value);
String mimeType;
if (!decoder->decode(mimeType))
return false;
response.setMimeType(mimeType);
String textEncodingName;
if (!decoder->decode(textEncodingName))
return false;
response.setTextEncodingName(textEncodingName);
int64_t contentLength;
if (!decoder->decode(contentLength))
return false;
response.setExpectedContentLength(contentLength);
String httpStatusText;
if (!decoder->decode(httpStatusText))
return false;
response.setHTTPStatusText(httpStatusText);
String suggestedFilename;
if (!decoder->decode(suggestedFilename))
return false;
response.setSuggestedFilename(suggestedFilename);
resourceResponse = response;
}
return decodePlatformData(decoder, resourceResponse);
}
示例5: willLoadXHR
void InspectorResourceAgent::willLoadXHR(ThreadableLoaderClient* client, const String& method, const KURL& url, bool async, PassRefPtr<FormData> formData, const HTTPHeaderMap& headers, bool includeCredentials)
{
RefPtr<XHRReplayData> xhrReplayData = XHRReplayData::create(method, url, async, formData, includeCredentials);
HTTPHeaderMap::const_iterator end = headers.end();
for (HTTPHeaderMap::const_iterator it = headers.begin(); it!= end; ++it)
xhrReplayData->addHeader(it->key, it->value);
m_pendingXHRReplayData.set(client, xhrReplayData);
}
示例6: buildObjectForHeaders
static PassRefPtr<InspectorObject> buildObjectForHeaders(const HTTPHeaderMap& headers)
{
RefPtr<InspectorObject> headersObject = InspectorObject::create();
HTTPHeaderMap::const_iterator end = headers.end();
for (HTTPHeaderMap::const_iterator it = headers.begin(); it != end; ++it)
headersObject->setString(it->first.string(), it->second);
return headersObject;
}
示例7: allowsCrossSiteHeaders
bool PreflightResultCacheItem::allowsCrossSiteHeaders(const HTTPHeaderMap& requestHeaders) const
{
HTTPHeaderMap::const_iterator end = requestHeaders.end();
for (HTTPHeaderMap::const_iterator it = requestHeaders.begin(); it != end; ++it) {
if (!m_headers.contains(it->first) && !isOnAccessControlSimpleRequestHeaderWhitelist(it->first))
return false;
}
return true;
}
示例8: allowsCrossOriginHeaders
bool CrossOriginPreflightResultCacheItem::allowsCrossOriginHeaders(const HTTPHeaderMap& requestHeaders, String& errorDescription) const
{
HTTPHeaderMap::const_iterator end = requestHeaders.end();
for (HTTPHeaderMap::const_iterator it = requestHeaders.begin(); it != end; ++it) {
if (!m_headers.contains(it->first) && !isOnAccessControlSimpleRequestHeaderWhitelist(it->first, it->second)) {
errorDescription = "Request header field " + it->first.string() + " is not allowed by Access-Control-Allow-Headers.";
return false;
}
}
return true;
}
示例9: isSimpleOrForbiddenRequest
bool FetchUtils::isSimpleOrForbiddenRequest(const String& method, const HTTPHeaderMap& headerMap)
{
if (!isSimpleMethod(method))
return false;
HTTPHeaderMap::const_iterator end = headerMap.end();
for (HTTPHeaderMap::const_iterator it = headerMap.begin(); it != end; ++it) {
if (!isSimpleHeader(it->key, it->value) && !isForbiddenHeaderName(it->key))
return false;
}
return true;
}
示例10: isSimpleCrossOriginAccessRequest
bool isSimpleCrossOriginAccessRequest(const String& method, const HTTPHeaderMap& headerMap)
{
if (!isOnAccessControlSimpleRequestMethodWhitelist(method))
return false;
HTTPHeaderMap::const_iterator end = headerMap.end();
for (HTTPHeaderMap::const_iterator it = headerMap.begin(); it != end; ++it) {
if (!isOnAccessControlSimpleRequestHeaderWhitelist(it->first, it->second))
return false;
}
return true;
}
示例11: startHttp
bool ResourceHandle::startHttp(String urlString)
{
if (!session) {
session = soup_session_async_new();
soup_session_add_feature(session, SOUP_SESSION_FEATURE(getCookieJar()));
const char* soup_debug = g_getenv("WEBKIT_SOUP_LOGGING");
if (soup_debug) {
int soup_debug_level = atoi(soup_debug);
SoupLogger* logger = soup_logger_new(static_cast<SoupLoggerLogLevel>(soup_debug_level), -1);
soup_logger_attach(logger, session);
g_object_unref(logger);
}
}
SoupMessage* msg;
msg = soup_message_new(request().httpMethod().utf8().data(), urlString.utf8().data());
g_signal_connect(msg, "restarted", G_CALLBACK(restartedCallback), this);
g_signal_connect(msg, "got-headers", G_CALLBACK(gotHeadersCallback), this);
g_signal_connect(msg, "got-chunk", G_CALLBACK(gotChunkCallback), this);
HTTPHeaderMap customHeaders = d->m_request.httpHeaderFields();
if (!customHeaders.isEmpty()) {
HTTPHeaderMap::const_iterator end = customHeaders.end();
for (HTTPHeaderMap::const_iterator it = customHeaders.begin(); it != end; ++it)
soup_message_headers_append(msg->request_headers, it->first.utf8().data(), it->second.utf8().data());
}
FormData* httpBody = d->m_request.httpBody();
if (httpBody && !httpBody->isEmpty()) {
// Making a copy of the request body isn't the most efficient way to
// serialize it, but by far the most simple. Dealing with individual
// FormData elements and shared buffers should be more memory
// efficient.
//
// This possibly isn't handling file uploads/attachments, for which
// shared buffers or streaming should definitely be used.
Vector<char> body;
httpBody->flatten(body);
soup_message_set_request(msg, d->m_request.httpContentType().utf8().data(),
SOUP_MEMORY_COPY, body.data(), body.size());
}
d->m_msg = static_cast<SoupMessage*>(g_object_ref(msg));
soup_session_queue_message(session, d->m_msg, finishedCallback, this);
return true;
}
示例12: addHeadersFromHashMap
static void addHeadersFromHashMap(CFMutableURLRequestRef request, const HTTPHeaderMap& requestHeaders)
{
if (!requestHeaders.size())
return;
HTTPHeaderMap::const_iterator end = requestHeaders.end();
for (HTTPHeaderMap::const_iterator it = requestHeaders.begin(); it != end; ++it) {
CFStringRef key = it->first.createCFString();
CFStringRef value = it->second.createCFString();
CFURLRequestSetHTTPHeaderFieldValue(request, key, value);
CFRelease(key);
CFRelease(value);
}
}
示例13: isSimpleRequest
bool FetchUtils::isSimpleRequest(const String& method, const HTTPHeaderMap& headerMap)
{
if (!isSimpleMethod(method))
return false;
HTTPHeaderMap::const_iterator end = headerMap.end();
for (HTTPHeaderMap::const_iterator it = headerMap.begin(); it != end; ++it) {
// Preflight is required for MIME types that can not be sent via form
// submission.
if (!isSimpleHeader(it->key, it->value))
return false;
}
return true;
}
示例14: setHeaderFields
static inline void setHeaderFields(CFMutableURLRequestRef request, const HTTPHeaderMap& requestHeaders)
{
// Remove existing headers first, as some of them may no longer be present in the map.
RetainPtr<CFDictionaryRef> oldHeaderFields(AdoptCF, CFURLRequestCopyAllHTTPHeaderFields(request));
CFIndex oldHeaderFieldCount = CFDictionaryGetCount(oldHeaderFields.get());
if (oldHeaderFieldCount) {
Vector<CFStringRef> oldHeaderFieldNames(oldHeaderFieldCount);
CFDictionaryGetKeysAndValues(oldHeaderFields.get(), reinterpret_cast<const void**>(&oldHeaderFieldNames[0]), 0);
for (CFIndex i = 0; i < oldHeaderFieldCount; ++i)
CFURLRequestSetHTTPHeaderFieldValue(request, oldHeaderFieldNames[i], 0);
}
for (HTTPHeaderMap::const_iterator it = requestHeaders.begin(), end = requestHeaders.end(); it != end; ++it)
CFURLRequestSetHTTPHeaderFieldValue(request, it->key.string().createCFString().get(), it->value.createCFString().get());
}
示例15: addHeaders
static void addHeaders(JSContextRef context, JSObjectRef object, const HTTPHeaderMap& headers)
{
ASSERT_ARG(context, context);
ASSERT_ARG(object, object);
HTTPHeaderMap::const_iterator end = headers.end();
for (HTTPHeaderMap::const_iterator it = headers.begin(); it != end; ++it) {
JSStringRef field = JSStringCreateWithCharacters(it->first.characters(), it->first.length());
JSStringRef valueString = JSStringCreateWithCharacters(it->second.characters(), it->second.length());
JSValueRef value = JSValueMakeString(context, valueString);
JSObjectSetProperty(context, object, field, value, kJSPropertyAttributeNone, 0);
JSStringRelease(field);
JSStringRelease(valueString);
}
}