protected override void GetResponseHeaders(CefResponse response, out long responseLength, out string redirectUrl) { response.MimeType = "text/html"; response.Status = 200; response.StatusText = "OK, hello from handler!"; var headers = new NameValueCollection(StringComparer.InvariantCultureIgnoreCase); headers.Add("Cache-Control", "private"); response.SetHeaderMap(headers); responseLength = responseData.LongLength; redirectUrl = null; }
private void get_response_headers(cef_resource_handler_t *self, cef_response_t *response, long *response_length, cef_string_t *redirectUrl) { CheckSelf(self); var m_response = CefResponse.FromNative(response); long m_responseLength; string m_redirectUrl; GetResponseHeaders(m_response, out m_responseLength, out m_redirectUrl); *response_length = m_responseLength; if (!string.IsNullOrEmpty(m_redirectUrl)) { cef_string_t.Copy(m_redirectUrl, redirectUrl); } }
/// <summary> /// Retrieve response header information. If the response length is not known /// set |response_length| to -1 and ReadResponse() will be called until it /// returns false. If the response length is known set |response_length| /// to a positive value and ReadResponse() will be called until it returns /// false or the specified number of bytes have been read. Use the |response| /// object to set the mime type, http status code and other optional header /// values. To redirect the request to a new URL set |redirectUrl| to the new /// URL. /// </summary> protected abstract void GetResponseHeaders(CefResponse response, out long responseLength, out string redirectUrl);
/// <summary> /// Returns the response, or NULL if no response information is available. /// Response information will only be available after the upload has completed. /// The returned object is read-only and should not be modified. /// </summary> public CefResponse GetResponse() { return(CefResponse.FromNativeOrNull( cef_urlrequest_t.get_response(_self) )); }
/// <summary> /// Create a new CefResponse object. /// </summary> public static CefResponse Create() { return(CefResponse.FromNative( cef_response_t.create() )); }