http-headers

How can I set User-Agent and Referer headers when using ClientWebSocket in .net 4.5?

笑着哭i 提交于 2019-12-19 08:50:26
问题 The obvious answer of using ClientWebSocket.SetHeader throws an exception because it's a protected header: System.ArgumentException occurred Message=The 'User-Agent' header must be modified using the appropriate property or method. Parameter name: name ParamName=name StackTrace: at System.Net.WebHeaderCollection.ThrowOnRestrictedHeader(String headerName) The exception string suggests using a property/method on the ClientWebSocket itself but I can't find any such property/method. It seems this

How Set Authorization headers at HTML Form or at A href

半腔热情 提交于 2019-12-19 07:58:21
问题 I have this code: $.ajax({ url: "http://localhost:15797/api/values", type: 'get', contentType: 'application/json', headers: { "Authorization": "Bearer " + token } }) works fine, but I want to do that without using Ajax, I want something like that: <form action="http://localhost:15797/api/values" method="get"> <input type="hidden" name="headers[Authorization]" value="Bearer token" /> <input type="submit" /> </form> Is it possible? Or just do something like that without XMLHttpRequest? How? 回答1

chrome extension: refuse header “date” in ajax request

僤鯓⒐⒋嵵緔 提交于 2019-12-19 06:19:11
问题 I have a javascript code to be used for api (ajax) and I need to send header "date" to api-server (required header), but chrome tells me 'refused to set unsafe header "Date" ' and I get response from api-server like "missing required http date header". I'm using jquery. code sample: var d = new Date(); var headers = {}; headers["Date"] = d.toUTCString(); jQuery.ajax({ url: '<some HTTPS url>' type: "get", crossDomain: true, headers: headers, .... }) the same code works fine in firefox. does

chrome extension: refuse header “date” in ajax request

寵の児 提交于 2019-12-19 06:19:11
问题 I have a javascript code to be used for api (ajax) and I need to send header "date" to api-server (required header), but chrome tells me 'refused to set unsafe header "Date" ' and I get response from api-server like "missing required http date header". I'm using jquery. code sample: var d = new Date(); var headers = {}; headers["Date"] = d.toUTCString(); jQuery.ajax({ url: '<some HTTPS url>' type: "get", crossDomain: true, headers: headers, .... }) the same code works fine in firefox. does

Change default ASP MVC Request Header to add your own values

做~自己de王妃 提交于 2019-12-19 05:56:29
问题 Im trying to change all my ASP MVC HTTP response headers to have another value by default for implementing Pingback auto-discovery in my blog application. The default header (on Cassini) is : Cache-Control private Connection Close Content-Length 20901 Content-Type text/html; charset=utf-8 Date Fri, 20 Apr 2012 22:46:11 GMT Server ASP.NET Development Server/10.0.0.0 X-AspNet-Version 4.0.30319 X-AspNetMvc-Version 3.0 and i want an extra value added : X-Pingback: http://localhost:4912/pingback

remove server header tomcat

时光怂恿深爱的人放手 提交于 2019-12-19 05:10:43
问题 I am able to rename the value of org.apache.coyote.http11.Http11Protocol.SERVER to anything else, so the HTTP-Response-Header contains something like: Server:Apache instead of the default Server:Apache-Coyote/1.1 Using a empty value for org.apache.coyote.http11.Http11Protocol.SERVER does not remove the Server-Header. How can I remove the Server-Header from my resonses? 回答1: Short answer - you can't remove the header, but you should modify it (see other answers). The server header is defined

What's the difference between the lang attribute and the <meta http-equiv=“Content-Language” content=“en-US”> tag?

若如初见. 提交于 2019-12-19 05:07:21
问题 I was wondering what's the significance of using the "lang" attribute and how that differs from using the meta "Content-Language" tag? Consider the following code: <html lang="en"> <head> <meta http-equiv="Content-Language" content="en-US"> </head>... My assumption is that the browser is reading the meta tag's value, but the DOM is concerned with the "lang" attribute. Is this correct? Are there any nuances I'm unaware of? 回答1: The lang attribute (on the HTML element) specifies the language

A way to prevent a mobile browser from downloading and displaying images

六月ゝ 毕业季﹏ 提交于 2019-12-19 04:55:43
问题 Is there a simple way to prevent browser from downloading and displaying images, best would be via some magic style tag or javasctipe. The thing is, I'd like to tweak the company's website a bit to be more usable via mobile devices. The company is a gaming one, there's like 5MBs of images on it's main page (and those can't be touched). They alredy display deadly slow on my dsl, and they can be killers to someone who's paying for his GPRS per MB ;) The code of the page is not mine and shouldn

HttpClient: Can´t access to response headers

不问归期 提交于 2019-12-19 04:22:40
问题 In a project, we used both Http & HttpClient to fetch the header params. Http returns the header params, but HttpClient doesn't. constructor(private http: Http, private httpClient: HttpClient) {} getContent() { const url = ''; return this.http.post(url, data) .map((res: HttpResponse<any>) => { console.log('http content', res); }); return this.httpClient.post(url, data, { observe: 'response' }) .map((res: HttpResponse<any>) => { console.log('httpClient content',res); }); } When checked in

How to exploit HTTP header XSS vulnerability?

不羁的心 提交于 2019-12-19 04:07:46
问题 Let's say that a page is just printing the value of the HTTP 'referer' header with no escaping. So the page is vulnerable to an XSS attack, i.e. an attacker can craft a GET request with a referer header containing something like <script>alert('xss');</script> . But how can you actually use this to attack a target? How can the attacker make the target issue that specific request with that specific header? 回答1: This sounds like a standard reflected XSS attack. In reflected XSS attacks, the