http-headers

PHP header() call “crashing” script with HTTP 500 error [duplicate]

a 夏天 提交于 2019-12-10 11:47:11
问题 This question already has answers here : header(“location”) causes [500] internal server error? (4 answers) Closed last year . I use PHP 5.2.9. To see/log errors, at the beggining of my script I have: error_reporting(E_ALL | E_STRICT); ini_set('display_errors', 'On'); ini_set('log_errors', 'On'); ini_set('error_log', $_SERVER['DOCUMENT_ROOT'] . '/php.log'); But when I use the first of the next two lines, my script issue a HTTP 500 error, and nothing is displayed (except the 500 error) and

Detect gzip encoding to manually decompress response, but 'Content-Encoding' header missing

核能气质少年 提交于 2019-12-10 11:45:24
问题 I am using net/http library in 'Go' to make an HTTP GET request. In the response, i get 12 headers. But when i run the exact same query through postman, i get 16 headers. One of those missing is 'Content-Encoding'. I understand this must be a CORS issue. But since i have not set the header Accept-Encoding: gzip in my request, and i am still getting the gzip encoding in response, the Go transport is not automatically decompressing the response for me. So, i need to be able to manually detect

“Request Header Or Cookie Too Large” in nginx with proxy_pass

孤街浪徒 提交于 2019-12-10 11:39:27
问题 I have a following nginx setup on my server A (internet facing, only relevant parts): upstream new_api { server unix:///home/ubuntu/new_api/shared/tmp/sockets/puma.sock; } server { listen 80 default_server; listen [::]:80 default_server; large_client_header_buffers 4 16k; ssl_certificate /etc/nginx/cert.crt; ssl_certificate_key /etc/nginx/cert.key; location ~ (^(/some/location|/some/other)) { proxy_pass http://new_api; } location / { proxy_pass https://serverB.com; } } Now, if I go to /some

How to modify request headers in c#,ASP .NET

戏子无情 提交于 2019-12-10 11:29:39
问题 I am working on a ASP .NET mVC project & i have to change HttpHeaders. see the foolowing code snippet: WebRequest req= HttpWebRequest.Create("myURL"); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); req.Headers.Add("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.15) Gecko/2009101601 Firefox/3.0.15 (.NET CLR 3.5.30729)"); req.Headers.Add("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); req.Headers.Add("Accept-Language",

HTTP 500 error in wget

筅森魡賤 提交于 2019-12-10 11:27:19
问题 Take a look at this page: http://www.ptmytrade.com/product.asp?id=61363 It's loading fine (at least here). Now I would like to grab it with wget. $ wget http://www.ptmytrade.com/product.asp?id=61363 --debug DEBUG output created by Wget 1.12 on linux-gnu. --2011-05-21 18:24:51-- http://www.ptmytrade.com/product.asp?id=61363 Resolving www.ptmytrade.com... 205.209.150.134 Caching www.ptmytrade.com => 205.209.150.134 Connecting to www.ptmytrade.com|205.209.150.134|:80... connected. Created socket

Fetch HTTP response header/redirect status with PHP

女生的网名这么多〃 提交于 2019-12-10 11:26:48
问题 Hej there, I am currently working on a PHP-based Tool to monitor a rather large number of URLs and their redirect status. I have spent quite some time on finding the best way to fetch the content of the HTTP response headers to extract the current redirect code and location. This is how it's done at the moment: $resource = fopen( $url, 'r' ); $metadata = stream_get_meta_data( $resource ); $metadata = $metadata['wrapper_data']; // Looping through the array to find the necessary fields This

XMLHttpRequest progress tracking and Symfony (CORS)

末鹿安然 提交于 2019-12-10 11:26:37
问题 I'm making a website using the Symfony framework, on an ovh server. When an user changes page, I create a new XMLHttpRequest to avoid to reload all the page and improve user experience. Everything works well, but I want to add a loading bar while the next page is loading asynchronously. Unfortunately the lengthComputable parameter was false. To go through this issue, I've set the header on Symfony3 just before sending the response with theses lines : $length = strlen($event->getResponse()-

With the AWSiOS SDK how do you do a HEAD request on an S3 object?

二次信任 提交于 2019-12-10 11:14:35
问题 I'm looking to use the SDK (can't use ASI) to do HEAD requests on objects before I download them to determine the size. Is there a provided way to do this I'm overlooking, or am I forced to build up my own S3Request, setting the httpMethod property to be "HEAD" and passing the constructed S3Request to the invoke: method of AmazonS3Client ? Building the request myself gets a little dicey as I'm using federated users, so I wanted to make sure I wasn't duplicating something I had overlooked. 回答1

getting value of location header using python urllib2

岁酱吖の 提交于 2019-12-10 10:49:35
问题 when I use urllib2,and list the headers,I cannot see the 'Location' header. In [19]:p = urllib2.urlopen('http://www.example.com') In [21]: p.headers.items() Out[21]: [('transfer-encoding', 'chunked'), ('vary', 'Accept-Encoding'), ('server', 'Apache/2.2.3 (CentOS)'), ('last-modified', 'Wed, 09 Feb 2011 17:13:15 GMT'), ('connection', 'close'), ('date', 'Fri, 25 May 2012 03:00:02 GMT'), ('content-type', 'text/html; charset=UTF-8')] If I use telnet and GET telnet www.example.com 80 Trying 192.0

New Line definition for HTTP/1.1 headers

隐身守侯 提交于 2019-12-10 10:41:18
问题 I have an embedded system that makes a HTTP POST request, however I know that the headers must have a format. In this case I have this request: POST / HTTP/1.1\n Host: 192.168.1.15\n Connection: close\n Content-Length: 44\n Content-Type: application/json\n \n {\n "command": "snapPicture",\n "selfTimer": 0\n } I want to avoid any kind of error while I send this request. Strictly talking, is it correct use \n to tell new line or should be \r\n ? Any suggestion about this request format? Thanks