Umm, ok, after sending some data to the server, noting this particular part:
"Accept-Encoding: gzip,deflate\r\n"
I am getting the following response:
HTTP/1.1 200 OK
Server: nginx
Date: Fri, 09 Apr 2010 23:25:27 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/5.2.8
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Last-Modified: Fri, 09 Apr 2010 23:25:27 GMT
Cache-Control: no-store, no-cache, must-revalidate
Cache-Control: post-check=0, pre-check=0
Pragma: no-cache
Content-Encoding: gzip
Vary: Accept-Encoding
7aa
??U-?Rh?%?2?w??PM]??7?qZ?K?)???2?&??m???"q??/p9w?????x?[`tA!G???G?5z??????a>k????????Q
???N??
('??f?,(??Y:5B???-?)?3x^0e:j?`,???**???F>G)?2????#???b??????A?k???Ar?n?
But how do I decompress it? Note that I am using the Socket Class to do all the work.
I know how to decompress it, but the problem here lies in the fact that I cannot separate the Packet from the GZipped data, psuedo-psuedocode (or whatever) on how I do it:
Socket sends packet;
Socket reads response from server, stores into a ByteArray;
Create MemoryStream, use ByteArray;
Create GZipStream, use Memorystream;
now the problem occurs; I am getting the following Error:
System.IO.InvalidDataException
The magic number in GZip header is not
correct. Make sure you are passing in
a GZip stream.
I hope the explanation is clear enough >__>.
The content that you need to gzip begins after a double-newline, and goes for (if present) Content-Length bytes. You might start there.
Is it possible for you to use System.Web.HttpRequest? It will take care of a lot of the administrative details of parsing the response for you...
Or do you have to use raw Sockets?
Related
Every article on the following website fails when attempting to share the page via the share link in our social media widget.
for example:
the following page, http://news.gc.ca/web/article-en.do?mthd=index&crtr.page=1&nid=957389 when shared via the following link:
Returns an Error: Connection error in the share preview window. Response headers for this request are:
Cache-Control: private, no-cache, no-store, must-revalidate
Content-Encoding: gzip
Content-Type: text/html
Date: Wed, 01 Apr 2015 14:22:20 GMT
Expires: Sat, 01 Jan 2000 00:00:00 GMT
Pragma: no-cache
Strict-Transport-Security: max-age=15552000; preload
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
X-FB-Debug: iYvCJSRJJqVdVXyIubD1kVq6teZBILIBRrCACZW9hI/Ms+B2qsquq52KyU5820UTfLmuXTis3LbRoL2bMlCVBw==
X-Frame-Options: DENY
X-XSS-Protection: 0
X-Firefox-Spdy: 3.1
200 OK
running the above URL through the OpenGraph object debugger returns:
Error parsing input URL, no data was cached, or no data was scraped.
and the scraper sees the following for the URL:
Document returned no data
We need to determine the cause of this since none of our content can be shared from our site at the moment.
Any ideas, tips greatly appreciated!
Background info: Some of my website innerpages had malware on it last week. The whole site has been reset, updated en cleared from malware a couple days ago. The website is SE optimized, but not spammed at all.
Q: Some innerpages of the website have suddenly dropped from the Google results.
Searching site: http://www.domain.com/innerpage doesn't even give a result.
Searching cache: http://www.domain.com/innerpage has no results since today
Webmaster page error: The page seems to redirect to itself. This may result in an infinite redirect loop. Please check the Help Center article about redirects.
HTTP/1.1 301 Moved Permanently
Date: Mon, 28 Oct 2013 20:15:18 GMT
Server: Apache
X-Powered-By: PHP/5.3.21
Set-Cookie: PHPSESSID=170fc3f0740f2eb26ed661493992843a; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
X-Pingback: http://www.domain.com/xmlrpc.php
Location: http://www.domain.com/innerpage/
Vary: Accept-Encoding,User-Agent
Content-Encoding: gzip
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8
The .htaccess file looks fine too. Do you guys have any idea what going on here?
The page is w3c valid and even online googlebot simulators show state 200 OK.
I try to send Last-Modified header. I can see it when run project on local computer but when I run copy of it on virtual host there is no Last-Modified header.
class InfoController extends Zend_Controller_Action
{
public function indexAction(){
$arr = strip_tags($this->_getParam('link'));
$material = new Application_Model_InlineMenus();
$mat = $material->preparematerial($arr);
$header= $this->getResponse()->setHeader("Last_Modified", gmdate("D, d M Y H:i:s", strtotime($mat['created']))." GMT", true);
//other parts of code
}
}
This is what I have in firebug when run project on local machine
Cache-Control no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection Keep-Alive
Content-Length 4563
Content-Type text/html
Date Fri, 15 Feb 2013 10:31:49 GMT
Expires Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive timeout=5, max=99
Last-Modified Thu, 14 Feb 2013 12:41:31 GMT
Pragma no-cache
Server Apache/2.2.22 (Win32) PHP/5.3.13
X-Powered-By PHP/5.3.13
And this is what I've got on my hosting
Cache-Control no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection keep-alive
Content-Encoding gzip
Content-Type text/html; charset=UTF-8
Date Fri, 15 Feb 2013 10:34:06 GMT
Expires Thu, 19 Nov 1981 08:52:00 GMT
Pragma no-cache
Server nginx/1.1.10
Transfer-Encoding chunked
X-Powered-By PHP/5.3.21
There is a single difference between local project and real project - I use .htaccess in www directiory to redirect requests to www/public directory.
UPD. I created plugin and in preDispatch() tried to set header and I've got http-code 500
Problem solved: disable SSI
our sports website provides an ICS calendar for our matches, draws etc.
For retrieving the ICS file we use a PHP script which reads the local ics file and then does some optional filtering on the VEVENT records etc. and returns the ICS data.
I have subscribed this ICS webcal via webcal://.... on my iPhone.
I now have the weird behaviour that SOME whole day events (DURATION:P1D) like this
BEGIN:VEVENT
DTSTART;VALUE=DATE:20120623
DURATION:P1D
TRANSP:TRANSPARENT
SUMMARY:Auslosung: VWM: Super Globe
DESCRIPTION:VWM: Super Globe
UID:20110124#thw-provinzial.de
CATEGORIES:THW-Termin
URL:http://www.thw-provinzial.de/thw/
COMMENT:TYPE=VWM
END:VEVENT
span two days in my iPhone Calendar if I subscribe the PHP script via webcal://www.thw-provinzial.de/thw/ics.php?config=all?.
(It is shown on 20120623 and 20120624)
If I subscribe the ics file directly via http://www.thw-provinzial.de/thw/thwdate2.ics the event is shown correctly only on day 20120623.
If I do a
wget http://www.thw-provinzial.de/thw/thwdate2.ics
wget http://www.thw-provinzial.de/thw/ics.php?config=all
and then diff the two outputs the only difference is the X-WR-CALNAME all other content is identical.
Could it be that some header information in the response is confusing the iPhone?
Response header of the thwdate2.ics -here the behvaiour is fine
HTTP/1.0 200 OK
Date: XXXXXX
Server: Apache
Last-Modified: Wed, 13 Jun 2012 20:05:04 GMT
ETag: "6c6f78d-c54d-4c260194d7c00"
Accept-Ranges: bytes
Content-Length: 50509
Vary: Accept-Encoding,User-Agent
Content-Type: text/calendar
Age: 787
Response header of the ics.php - here we have the problem with spanning over 2 days
HTTP/1.0 200 OK
Date: Thu, XXXXXX
Server: Apache
Content-Disposition: inline; filename=thwdates.ics
Pragma: no-cache
Cache-Control: no-cache, must-revalidate
Expires: Sat, 26 Jul 1997 05:00:00 GMT
Last-Modified: Wed, 13 Jun 2012 20:05:04 GMT
Vary: Accept-Encoding,User-Agent
Content-Type: text/calendar; charset=utf-8
Any ideas?
I want to write an integration test for a library that handles streamed http responses that are chunked and gzipped.
Are there any services or other suggestions I could use to do this?
Ideal endpoint or service would have:
Free
Chunked
No authentication needed
Sending at least 5k of gzipped content
The Twitter API would be perfect if it didn't require an account.
Maybe I'm over-thinking this, please say so and I'll eat my humble pie.
Looks like github.com returns chunked gzip. Example:
curl --compressed -v https://github.com/madler/zlib/commits/develop > /dev/null
...
< Server: nginx/1.0.13
< Date: Sun, 01 Apr 2012 21:32:28 GMT
< Content-Type: text/html; charset=utf-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< Status: 200 OK
< ETag: "bae161c1cbcaa8882f8b5c6cb1d1d270"
< X-Frame-Options: deny
< X-Runtime: 107
< Set-Cookie: _gh_sess=BAh7BzoPc2Vzc2lvbl9pZCIlZjhkOWYxYzUzMzhjMTIxZTRmYjUyZTY2MWY0YWVjZGI6EF9jc3JmX3Rva2VuIjFUK2dFR1podXlTMjcralpLUmkyTkpYZzE5ZzBLS3BLODl0OTE0VEt0ZGdJPQ%3D%3D--95e44cf6b548b93a682fdefcbca6b84cb034ca8b; path=/; expires=Sat, 01-Jan-2022 00:00:00 GMT; secure; HttpOnly
< Cache-Control: private, max-age=0, must-revalidate
< Strict-Transport-Security: max-age=2592000
< Content-Encoding: gzip
<