/** OnRequest ** This ovverrides the default OnRequest method of the standard resource interceptor. It receives ** the resource request object as a parameter. ** ** It first checks whether or not it is enabled, and returns NULL if not. Next it sees if any ** parameters are defined. If so, it converst them to a byte stream and appends them to the request. ** Currently, files are not handled, but we hope to add that someday. */ public ResourceResponse OnRequest(ResourceRequest request) { // We do nothing at all if we aren't enabled. This is a stopgap that prevents us from sending // POST data with every request. if (RequestEnabled == false) { return(null); } // If the Parameters are defined, convert them to a byte stream and append them to the request. if (Parameters != null) { var str = Encoding.Default.GetBytes(Parameters); var bytes = Encoding.UTF8.GetString(str); request.AppendUploadBytes(bytes, (uint)bytes.Length); } // If either the parameters or file path are defined, this is a POST request. Someday, we'll // figure out how to get Awesomium to understand Multipart Form data. if (Parameters != null || FilePath != null) { request.Method = "POST"; request.AppendExtraHeader("Content-Type", "application/x-www-form-urlencoded"); //"multipart/form-data"); } // Once the data has been appended to the page request, we need to disable this process. Otherwise, // it will keep adding the data to every request, including those that come from the web site. RequestEnabled = false; Parameters = null; FilePath = null; return(null); }
public ResourceResponse OnRequest(ResourceRequest request) { if(UserAgent != null) request.AppendExtraHeader("User-Agent", UserAgent); return null; }
public ResourceResponse OnRequest(ResourceRequest request) { if (UserAgent != null) { request.AppendExtraHeader(@"User-Agent", UserAgent); } return(null); }
protected override ResourceResponse OnRequest(ResourceRequest request) { request.Method = "POST"; var bytes = "Appending some text to the request"; request.AppendUploadBytes(bytes, (uint)bytes.Length); request.AppendExtraHeader("custom-header", "this is a custom header"); return(null); }
public ResourceResponse OnRequest(ResourceRequest request) { string login = "******"; string password = "******"; string data = @"_filter%5Btitle%5D=&_filter%5Bcount_min%5D=&_filter%5Bcount_max%5D=&_filter%5Blevel_min%5D=&_filter%5Blevel_max%5D=&_filter%5Bkind%5D=g1_12&_filter%5Bquality%5D=-1&_filterapply=%D0%9E%D0%BA"; request.Method = @"POST"; request.AppendUploadBytes(data, (uint)data.Length); request.AppendExtraHeader("Content-Type", "application/x-www-form-urlencoded"); return null; }
ResourceResponse IResourceInterceptor.OnRequest(ResourceRequest request) { string h; if (headers.TryRemove(request.Url, out h)) { var hs = h.Split(':'); request.AppendExtraHeader(hs[0], hs[1]); } return(null); }
public ResourceResponse OnRequest(ResourceRequest request) { if (request.Url.ToString().Contains("security_check.php")) { //Format data to be posted var data = "username="******"&password="******"POST"; request.AppendUploadBytes(data, (uint)data.Length); request.AppendExtraHeader("Content-Type", "application/x-www-form-urlencoded"); //Dispose of username and pass, to be sent to GC data = null; user = null; pass = null; } return(null); }
public ResourceResponse OnRequest(ResourceRequest request) { request.AppendExtraHeader("token", _token); return(null); }