http-headers

How to cache api response using curl, based on returned etag?

亡梦爱人 提交于 2019-12-08 02:04:18
问题 This is a quick question that might help other too. I have a rest service that will return a proper ETAG header for each GET query on it's endpoints. Now, i also need to create a curl http client to query these endpoints and make use of the etags. From my understanding, after making the first request with curl, i need to save the returned etag for later use, so that on all subsequent requests (till the etag invalidates on server) i use the cached version because the server will return a 304

Firefox fails to decompress gzip files

我与影子孤独终老i 提交于 2019-12-08 02:04:08
问题 I have .gz files stored on AWS s3. Using the s3 REST-API, I'm generating authenticated links that point to individual files. I'm also setting the content-header options such that browsers requesting these urls will decompress and download the gzipped files as attachments. The generated s3 url looks like so: https://MY_BUCKET.s3.amazonaws.com/PATH_TO/file.ext.gz ?AWSAccessKeyId=MY_KEY &Expires=DATE_TIME &Signature=MY_SIGNATURE &response-content-disposition=attachment%3B%20filename%3D%22file

Make an http post request to send a JSON file in WP7

故事扮演 提交于 2019-12-08 01:36:59
问题 I would like to send a JSON file from my WP7 device to my local server . On iOS I used the ASIHttpRequest library and what I did was : //send json file , using ASIHttpClass NSURL *url = [NSURL URLWithString:urlStr]; ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url]; request.timeOutSeconds = TIME_OUT_SECONDS; [request setRequestMethod:@"PUT"]; NSString *credentials= [self encodeCredentials]; [request addRequestHeader:@"Authorization" value:[[NSString alloc] initWithFormat:@"Basic %

CSRF Token in new Tab and browser Window

ⅰ亾dé卋堺 提交于 2019-12-08 01:36:27
问题 I have implemented CSRF attack prevention on my nodejs server in the following way - User on login receives a CSRF token and a cookie (JWT based token stored in a cookie). The CSRF token is made a part of all future request headers sent from the client using $.ajaxSetup . Whenever a request is made (GET or POST) by the user, I compare the cookie and csrf token (in the header) sent by the client with the stored ones on my server and the application works fine. However, when a logged-in user

Leverage browser caching not working - Htaccess & mod_expires Active

◇◆丶佛笑我妖孽 提交于 2019-12-08 01:22:40
问题 I´ve been trying to get The leverage browser cache for quite a while and I have no idea what could be the problem. I tried several methods to activate it, but nothing works... The site is running on Namecheap Hosting. I already contacted the support and asked if the mod_expires module is active and according to the customer support it is... This is the code I´ve been using: # START --- Browser Cache Control # Turn on Expires and set default to 0 ExpiresActive On ExpiresDefault A0 # Set up

How can we parse HTTP response header fields using Qt/C++?

我们两清 提交于 2019-12-08 00:44:57
问题 I am writing a piece of software that uses Qt/KDE libs. The objective is to parse the HTTP header response fields into different fields of a struct. So far the HTTP header response is contained in a QString. It looks something like this: "HTTP/1.1 302 Found date: Tue, 05 Jun 2012 07:40:16 GMT server: Apache/2.2.22 (Linux/SUSE) x-prefix: 49.244.80.0/21 x-as: 23752 x-mirrorbrain-mirror: mirror.averse.net x-mirrorbrain-realm: region link: <http://download.services.openoffice.org/files/du.list

Redirect not working with Header(Location ) and session variable

ε祈祈猫儿з 提交于 2019-12-08 00:26:14
问题 1: i use register.php to sign up the clients, 2: the data collected from the form is send to 1.php, it is saved in database 3: after form data is saved in database, 1.php forwards selected form data (myValue) to register.php?myValue='abc' in 1.php, i am saving a session variable like this @session_start(); $_SESSION['color']='blue'; the code of register.php is if (isset($_SESSION['color'])) { header('Location: http://mydomain.com/thankyou.php'); } else { @session_start(); some other stuff

php, curl, headers and content-type

耗尽温柔 提交于 2019-12-07 22:48:07
问题 I am having some trouble working with curl and headers returned by servers. 1) My php file on my_website.com/index.php looks like this (trimmed version): <?php $url = 'http://my_content_server.com/index.php'; //Open connection $ch = curl_init(); curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); //execute post $result = curl_exec($ch); //close connection curl_close($ch); echo $result; ?> The php file on my_content_server.com/index.php looks like this: <?php header

Simulate file form submission with XMLHttpRequest Level 2

做~自己de王妃 提交于 2019-12-07 22:23:45
问题 On my current page I use old file upload with input element. However, now I've implemented drag&drop from that very nice series of articles: http://www.sitepoint.com/html5-file-drag-and-drop/ There's one snag. Before rewriting the page I was submitting the form with the file and server side service (Java's appspot.com) did all the magic of retrieving the file, saving to DB etc. I would still like to take advantage of that service. However now, after rewriting the file upload to use

twisted location header redirect

笑着哭i 提交于 2019-12-07 21:30:50
问题 From the render_GET method of a Resource in twisted , is it possible to redirect to a different url entirely (hosted elsewhere) request.redirect(url) doesn't appear to do anything, and neither does twisted.web.util.Redirect The equivalent in php would be, header('location:'.$url); EDIT this is the code I'm running from twisted.web import server, resource from twisted.internet import reactor class Simple(resource.Resource): isLeaf = True def render_GET(self, request): request.redirect("www