http-headers

Server removes custom HTTP header fields

一世执手 提交于 2019-12-08 21:44:12
问题 I've been trying to receive HTTP requests with custom fields in the headers but it seems like my server removes them... This is the request that I am sending to the server (I read that request with a HTTP Proxy) : POST /oauth.php/request_token HTTP/1.1 Host: domain.com User-Agent: DearStranger/1.0 CFNetwork/485.12.7 Darwin/10.6.0 Authorization: OAuth realm="", oauth_consumer_key="ebb942f0d260b06cb533c6133c28408004d343197", oauth_signature_method="HMAC-SHA1", oauth_signature="qPBFAa8XRRbor2%2F

How to update metadata using Amazon S3 SDK

馋奶兔 提交于 2019-12-08 19:16:40
问题 I am using the PHP version of Amazon's AWS SDK. I have a bunch of files with an Expires header; I want to delete that header and add a Cache-control header instead. The update_object function lets me add headers but not remove them. The answers on this question suggest you can update a file's metadata when you copy it, but I have tried it and it doesn't work. Here is what I used: $response = $s3->copy_object( array( 'bucket' => $bucket, 'filename' => $file, ), array( 'bucket' => $bucket,

StrongLoop Loopback : How to customize HTTP response code and header

北慕城南 提交于 2019-12-08 19:06:50
问题 I'm looking for a way to customize StrongLoop LoopBack HTTP response code and headers. I would like to conform to some company business rules regarding REST API. Typical case is, for a model described in JSON, to have HTTP to respond to POST request with a code 201 + header Content-Location (instead of loopback's default response code 200 without Content-Location header). Is it possible to do that using LoopBack ? 回答1: Unfortunately the way to do this is a little difficult because LoopBack

How to let Apache send 500 in case of PHP error?

你说的曾经没有我的故事 提交于 2019-12-08 18:41:32
问题 I'm developing a PHP application that uses HTTP response codes for communication as well as response bodies. So this is a typical scenario in the PHP code: try { doSomething(); } catch (Exception $e) { header('HTTP/1.1 500 Internal Server Error'); } ... and the typical code in clients looks like: switch(responseCode) { case 200 : // all fine // .... case 500 : // trouble! } This is cool, as long as every error is well caught in PHP code. The problem: If, for any reason in the php code occures

Referer missing in HTTP header of Selenium request

淺唱寂寞╮ 提交于 2019-12-08 17:05:22
问题 I'm writing some tests with Selenium and noticed, that Referer is missing from the headers. I wrote the following minimal example to test this with https://httpbin.org/headers: import selenium.webdriver options = selenium.webdriver.FirefoxOptions() options.add_argument('--headless') profile = selenium.webdriver.FirefoxProfile() profile.set_preference('devtools.jsonview.enabled', False) driver = selenium.webdriver.Firefox(firefox_options=options, firefox_profile=profile) wait = selenium

PHP - Setting a file_get_contents timeout [duplicate]

落花浮王杯 提交于 2019-12-08 16:38:11
问题 This question already has answers here : Does file_get_contents() have a timeout setting? (5 answers) Closed 4 years ago . I am using file_get_contents to get a headers of an external page to determine if the external page is online like so: $URL = "http://page.location/"; $Context = stream_context_create(array( 'http' => array( 'method' => 'GET', ) )); file_get_contents($URL, false, $Context); $ResponseHeaders = $http_response_header; $header = substr($ResponseHeaders[0], 9, 3); if($header[0

How to remove date header from apache?

强颜欢笑 提交于 2019-12-08 16:25:31
问题 I need to minimize Apache HTTP response headers, by now i reduced them as following HTTP/1.1 200 OK Date: Thu, 25 Mar 2010 21:57:41 GMT Server: Apache Content-Type: text/html I'd like to know if there is a way to disable Date and Server header, only for a certain virtual host. Thank you! 回答1: The Date header is required at part of the HTTP standard. You can't remove it without being non-compliant with the http standard, so apache doesn't generally allow that. 来源: https://stackoverflow.com

Is using custom json content-types a good idea

萝らか妹 提交于 2019-12-08 14:57:56
问题 I'm designing a RESTful API and in an attempt to be descriptive and make documentation clearer I want to declare my content-type http header as follows: Content-Type: application/vnd.mycorp.mydatatype+json where mycorp is an identifier unique to my corporation and mydatatype is unique to each data type. An example would be: Content-Type: application/vnd.ford.car+json { "manufactured_year": 2000 , "color": "blue" , "hp": 160 , "model" "Focus" , "type": "sedan" } This content-type would be

IWebBrowser2 HTTP response headers

荒凉一梦 提交于 2019-12-08 13:55:52
问题 I have the same question that Dragos asked here "...Hi! I'm developing an application which hosts an web browser control. I'm getting access to it through IWebBrowser2 interface. Is there any way to have access programatically to the responses header..." The solution (from 2003) seems to be using an passthrough Asynchronous Pluggable Protocol (APP) handlers. The solution presented here was written in C++/ATL so I was wondering if there is an c# version of this? Note that I'm already able to

DropBox API application/octet-stream header

痞子三分冷 提交于 2019-12-08 13:50:44
问题 I'm attempting to make a cUrl request with PHP to the Dropbox API, in order to begin to upload a very large zip file. Here is the documentation I'm trying to implement, found at https://www.dropbox.com/developers/documentation/http/documentation#files-upload - URL structure: https://content.dropboxapi.com/2/files/upload_session/start Example cUrl Request: curl -X POST https://content.dropboxapi.com/2/files/upload_session/start \ --header "Authorization: Bearer <get access token>" \ --header