http-headers

ELMAH - How to log HTTP request body and HTTP request header with error log?

倾然丶 夕夏残阳落幕 提交于 2019-12-10 18:35:10
问题 I'm logging errors by specifically signalling errors ErrorSignal.FromCurrentContext().Raise(exception); How do I add request body and headers in the errors details. I'm just using the email feature. 回答1: My friend sent me this question which resolved my problem. 来源: https://stackoverflow.com/questions/9411306/elmah-how-to-log-http-request-body-and-http-request-header-with-error-log

Android socket & HTTP response headers

六眼飞鱼酱① 提交于 2019-12-10 18:25:54
问题 The funny thing is: I may have accidentally found the solution for Is it possible to send HTTP request using plain socket connection and receive response without headers?. I hope I'm overlooking something. Anyway, I'm connecting to a web server, send a HTTP request, receive the response and close the connection. The actual HTTP conversation (tcpdump on the server side) looks like this: GET /blah.php?param1=test1t&param2=test2 HTTP/1.0 HTTP/1.1 200 OK Date: Sat, 22 Sep 2012 10:16:46 GMT Server

How can I configure HTTP Response Headers in a Struts2 Interceptor?

此生再无相见时 提交于 2019-12-10 18:24:02
问题 We currently have a java web application in the middle of migration from Struts 1 to Struts 2. We would like to configure X-Frame-Options and Content-Security-Policy headers for all our Struts 2 actions. We have a lot of actions and I want to avoid modifying them all separately if at all possible. the idea I currently have is the following interceptor which would be added to the default stack: import javax.servlet.http.HttpServletResponse; import org.apache.struts2.ServletActionContext;

Http headers in Javascript?

喜你入骨 提交于 2019-12-10 18:16:46
问题 Is it possible to gather the HTTP headers in JavaScript ? This is just a thought of mine after using Firebug for days. In one of the posts I came to know that, it is impossible to find the HTTP headers in JavaScript, whereas in firebug, we can see the response headers (client side) so my question is can we cache the HTTP headers in JavaScript ? 回答1: The HTTP headers aren't available in JavaScript. However you could use XMLHttpRequest to do a HEAD request to any resource within the same domain

When I force downloading a file from a page, it split te file name by SPACE /C#?

只谈情不闲聊 提交于 2019-12-10 17:54:54
问题 Here is my code for the Force Download: // URL = Download.aspx?Url=How to use the Application.txt string q = Request.QueryString["Url"].ToString(); Response.Clear(); Response.AddHeader("Content-disposition", "Attachment; Filename=" + file); Response.ContentType = "Text/Plain"; Response.WriteFile(Server.MapPath("Directory/" + q)); Response.End(); The Dialog Box that apears in Firefox says: You are going to open the file: And the filename is displayed just ass How (the name should be: How to

Returning http status codes with a rest api

大城市里の小女人 提交于 2019-12-10 17:49:24
问题 I am building my own rest api in php for practice. I can evaluate the http code sent to my api (post,put,delete,get). But when I send out my response I really am just printing out a json. For example, I build a response in my api like this public function actionTest() { $rtn=array("id":"3","name":"John"); print json_encode($rtn); } I am not manipulating the headers in anyway. From reading stackoverflow, I understand that I should be returning http response codes to match my api results. How

headers_sent() return false, but headers were sent

寵の児 提交于 2019-12-10 17:11:20
问题 My code is simple: <!DOCTYPE html> <html> <head> ... <?php var_dump(headers_sent()); ?> It returns false. Shouldn't the headers be sent immediately after something is printed? Like just after the first < character. 回答1: It depends if your output_buffering directive in php.ini file. If it is Off output_buffering = Off then echo headers_sent() should output 1 In other cases, headers_sent() won't output any results because it will be FALSE. The headers won't be sent because the output is

Will iso-8859-1 display german umlauts ok or do I need to use utf-8?

主宰稳场 提交于 2019-12-10 17:10:03
问题 I have a multi language website that is hosted on a server that appears to have character encoding set to default to iso-8859-1. I thought I would be best having the pages utf-8 and included a meta tag to declare this. Unfortunately this meta tag seems to get overridden and the page defaults to iso-8859. Many special characters in the German and Dutch pages are not showing correctly. Do I need to try and change the server default to utf-8 or something? Maybe I could remove the server default

IIS 7.0 - IIS adding “private” to cache-control, where is that coming from

耗尽温柔 提交于 2019-12-10 17:04:12
问题 Because we protect .PDF files from anonymous users, we have a custom handler so we have an entry We also made a change to the http headers to add "cache-control: no-cache,no-store" via IIS 7 management which creates web.config entries under system.webserver element as follows: <httpProtocol> <customHeaders> <clear /> <add name="cache-control" value="no-cache,no-store" /> </customHeaders> </httpProtocol> When I review the Response headers in a burpsuite session, I see for .aspx pages: cache

How to tell when a web page has changed by x% in VB.net?

纵饮孤独 提交于 2019-12-10 16:34:36
问题 I'm trying to write a little utility which will check periodically and tell me if/when a web page's (could be any URL) content has changed. I've read the other postings but they don't really answer my question (as far as I can tell). I know for static pages there is a last-modified header. However, what about dynamic pages? I got Oli's comment that storing a hash of the contents works but that's not really idea because the page might simply have a time stamp on it (the date-time that the page