示例#1
0
        /// <summary>
        /// Set all values at one time.
        /// </summary>
        public unsafe virtual void Set(string url, string method, CefPostData postData, CefStringMultimap headerMap)
        {
            fixed(char *s0 = url)
            fixed(char *s1 = method)
            {
                var cstr0 = new cef_string_t {
                    Str = s0, Length = url != null ? url.Length : 0
                };
                var cstr1 = new cef_string_t {
                    Str = s1, Length = method != null ? method.Length : 0
                };

                NativeInstance->Set(&cstr0, &cstr1, (postData != null) ? postData.GetNativeInstance() : null, headerMap);
            }
            GC.KeepAlive(this);
        }
示例#2
0
 /// <summary>
 /// Set the header values. If a Referer value exists in the header map it will
 /// be removed and ignored.
 /// </summary>
 public unsafe virtual void SetHeaderMap(CefStringMultimap headerMap)
 {
     NativeInstance->SetHeaderMap(headerMap);
     GC.KeepAlive(this);
 }
示例#3
0
        /// <summary>
        /// Send a custom HTTP response to the connection identified by
        /// |connection_id|. |response_code| is the HTTP response code sent in the
        /// status line (e.g. 200), |content_type| is the response content type sent as
        /// the &quot;Content-Type&quot; header (e.g. &quot;text/html&quot;), |content_length| is the
        /// expected content length, and |extra_headers| is the map of extra response
        /// headers. If |content_length| is &gt;= 0 then the &quot;Content-Length&quot; header will
        /// be sent. If |content_length| is 0 then no content is expected and the
        /// connection will be closed automatically after the response is sent. If
        /// |content_length| is
        /// &lt;
        /// 0 then no &quot;Content-Length&quot; header will be sent and
        /// the client will continue reading until the connection is closed. Use the
        /// SendRawData function to send the content, if applicable, and call
        /// CloseConnection after all content has been sent.
        /// </summary>
        public unsafe virtual void SendHttpResponse(int connectionId, int responseCode, string contentType, long contentLength, CefStringMultimap extraHeaders)
        {
            fixed(char *s2 = contentType)
            {
                var cstr2 = new cef_string_t {
                    Str = s2, Length = contentType != null ? contentType.Length : 0
                };

                NativeInstance->SendHttpResponse(connectionId, responseCode, &cstr2, contentLength, extraHeaders);
            }

            GC.KeepAlive(this);
        }