websocket always triggers onerror(undefined) with Chrome, but not with Firefox - google-chrome

With a websocket server(C program) running in Cygwin, which does the handshaking&echoing back the messages from client.
With Firefox(Version 13.0.1), the two parties work together very well - handshaking , receiving and echoing back.
But with Chrome(Version 23.0.1271.97 m), after the handshaking step, the client always triggers onerror - "undefined", then onclose.
I was wondering:
Are there any differences between Firefox and Chrome how they handle websocket?
Here is the HTML code(Thanks to stackoverflow guys contribution):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
function connect() {
var ws = new WebSocket("ws://localhost:8080/service");
ws.onopen = function () {
alert("About to send data");
ws.send("Hello World"); // I WANT TO SEND THIS MESSAGE TO THE SERVER!!!!!!!!
alert("Message sent!");
};
ws.onmessage = function (evt) {
alert("About to receive data");
var received_msg = evt.data;
alert("Message received = "+received_msg);
};
ws.onclose = function () {
// websocket is closed.
alert("Connection is closed...");
};
ws.onerror = function (evt) {
alert("ERROR: "+evt.data);
};
};
</script>
</head>
<body style="font-size:xx-large" >
<div>
Click here to start</div>
</body>
</html>
Here is data log captured on server side with Firefox:
websocket server received:
0001 47 45 54 20 2f 73 65 72 76 69 63 65 20 48 54 54 GET /service HTT
0002 50 2f 31 2e 31 0d 0a 48 6f 73 74 3a 20 6c 6f 63 P/1.1..Host: loc
0003 61 6c 68 6f 73 74 3a 38 30 38 30 0d 0a 55 73 65 alhost:8080..Use
0004 72 2d 41 67 65 6e 74 3a 20 4d 6f 7a 69 6c 6c 61 r-Agent: Mozilla
0005 2f 35 2e 30 20 28 57 69 6e 64 6f 77 73 20 4e 54 /5.0 (Windows NT
0006 20 36 2e 31 3b 20 57 4f 57 36 34 3b 20 72 76 3a 6.1; WOW64; rv:
0007 31 33 2e 30 29 20 47 65 63 6b 6f 2f 32 30 31 30 13.0) Gecko/2010
0008 30 31 30 31 20 46 69 72 65 66 6f 78 2f 31 33 2e 0101 Firefox/13.
0009 30 2e 31 0d 0a 41 63 63 65 70 74 3a 20 74 65 78 0.1..Accept: tex
0010 74 2f 68 74 6d 6c 2c 61 70 70 6c 69 63 61 74 69 t/html,applicati
0011 6f 6e 2f 78 68 74 6d 6c 2b 78 6d 6c 2c 61 70 70 on/xhtml+xml,app
0012 6c 69 63 61 74 69 6f 6e 2f 78 6d 6c 3b 71 3d 30 lication/xml;q=0
0013 2e 39 2c 2a 2f 2a 3b 71 3d 30 2e 38 0d 0a 41 63 .9,*/*;q=0.8..Ac
0014 63 65 70 74 2d 4c 61 6e 67 75 61 67 65 3a 20 65 cept-Language: e
0015 6e 2d 75 73 2c 65 6e 3b 71 3d 30 2e 35 0d 0a 41 n-us,en;q=0.5..A
0016 63 63 65 70 74 2d 45 6e 63 6f 64 69 6e 67 3a 20 ccept-Encoding:
0017 67 7a 69 70 2c 20 64 65 66 6c 61 74 65 0d 0a 43 gzip, deflate..C
0018 6f 6e 6e 65 63 74 69 6f 6e 3a 20 6b 65 65 70 2d onnection: keep-
0019 61 6c 69 76 65 2c 20 55 70 67 72 61 64 65 0d 0a alive, Upgrade..
0020 53 65 63 2d 57 65 62 53 6f 63 6b 65 74 2d 56 65 Sec-WebSocket-Ve
0021 72 73 69 6f 6e 3a 20 31 33 0d 0a 4f 72 69 67 69 rsion: 13..Origi
0022 6e 3a 20 6e 75 6c 6c 0d 0a 53 65 63 2d 57 65 62 n: null..Sec-Web
0023 53 6f 63 6b 65 74 2d 4b 65 79 3a 20 61 41 48 6e Socket-Key: aAHn
0024 63 31 77 66 6e 68 39 39 53 6d 59 67 4d 50 6b 4d c1wfnh99SmYgMPkM
0025 57 77 3d 3d 0d 0a 50 72 61 67 6d 61 3a 20 6e 6f Ww==..Pragma: no
0026 2d 63 61 63 68 65 0d 0a 43 61 63 68 65 2d 43 6f -cache..Cache-Co
0027 6e 74 72 6f 6c 3a 20 6e 6f 2d 63 61 63 68 65 0d ntrol: no-cache.
0028 0a 55 70 67 72 61 64 65 3a 20 77 65 62 73 6f 63 .Upgrade: websoc
0029 6b 65 74 0d 0a 0d 0a ket....
websocket server sent:
0001 48 54 54 50 2f 31 2e 31 20 31 30 31 20 53 77 69 HTTP/1.1 101 Swi
0002 74 63 68 69 6e 67 20 50 72 6f 74 6f 63 6f 6c 73 tching Protocols
0003 0d 0a 55 70 67 72 61 64 65 3a 20 77 65 62 73 6f ..Upgrade: webso
0004 63 6b 65 74 0d 0a 43 6f 6e 6e 65 63 74 69 6f 6e cket..Connection
0005 3a 20 55 70 67 72 61 64 65 0d 0a 53 65 63 2d 57 : Upgrade..Sec-W
0006 65 62 53 6f 63 6b 65 74 2d 41 63 63 65 70 74 3a ebSocket-Accept:
0007 20 74 66 48 33 51 6f 70 47 2f 61 50 78 49 4c 65 tfH3QopG/aPxILe
0008 55 75 49 39 48 38 34 46 49 35 63 77 3d 0d 0a 53 UuI9H84FI5cw=..S
0009 65 63 2d 57 65 62 53 6f 63 6b 65 74 2d 50 72 6f ec-WebSocket-Pro
0010 74 6f 63 6f 6c 3a 20 63 68 61 74 0d 0a 0d 0a tocol: chat....
Sent OKAY.
websocket server received:
0001 81 8b 75 cb 87 1a 3d ae eb 76 1a eb d0 75 07 a7 ..u...=..v...u..
0002 e3 .
websocket server sent:
...
Data log with Chrome:
websocket server received:
0001 47 45 54 20 2f 73 65 72 76 69 63 65 20 48 54 54 GET /service HTT
0002 50 2f 31 2e 31 0d 0a 55 70 67 72 61 64 65 3a 20 P/1.1..Upgrade:
0003 77 65 62 73 6f 63 6b 65 74 0d 0a 43 6f 6e 6e 65 websocket..Conne
0004 63 74 69 6f 6e 3a 20 55 70 67 72 61 64 65 0d 0a ction: Upgrade..
0005 48 6f 73 74 3a 20 6c 6f 63 61 6c 68 6f 73 74 3a Host: localhost:
0006 38 30 38 30 0d 0a 4f 72 69 67 69 6e 3a 20 6e 75 8080..Origin: nu
0007 6c 6c 0d 0a 53 65 63 2d 57 65 62 53 6f 63 6b 65 ll..Sec-WebSocke
0008 74 2d 4b 65 79 3a 20 6a 79 38 30 61 2b 50 72 73 t-Key: jy80a+Prs
0009 35 48 71 62 36 62 58 50 2f 43 58 51 51 3d 3d 0d 5Hqb6bXP/CXQQ==.
0010 0a 53 65 63 2d 57 65 62 53 6f 63 6b 65 74 2d 56 .Sec-WebSocket-V
0011 65 72 73 69 6f 6e 3a 20 31 33 0d 0a 53 65 63 2d ersion: 13..Sec-
0012 57 65 62 53 6f 63 6b 65 74 2d 45 78 74 65 6e 73 WebSocket-Extens
0013 69 6f 6e 73 3a 20 78 2d 77 65 62 6b 69 74 2d 64 ions: x-webkit-d
0014 65 66 6c 61 74 65 2d 66 72 61 6d 65 0d 0a 0d 0a eflate-frame....
websocket server sent:
0001 48 54 54 50 2f 31 2e 31 20 31 30 31 20 53 77 69 HTTP/1.1 101 Swi
0002 74 63 68 69 6e 67 20 50 72 6f 74 6f 63 6f 6c 73 tching Protocols
0003 0d 0a 55 70 67 72 61 64 65 3a 20 77 65 62 73 6f ..Upgrade: webso
0004 63 6b 65 74 0d 0a 43 6f 6e 6e 65 63 74 69 6f 6e cket..Connection
0005 3a 20 55 70 67 72 61 64 65 0d 0a 53 65 63 2d 57 : Upgrade..Sec-W
0006 65 62 53 6f 63 6b 65 74 2d 41 63 63 65 70 74 3a ebSocket-Accept:
0007 20 4d 39 2f 58 41 4e 67 35 52 32 58 4f 4d 50 49 M9/XANg5R2XOMPI
0008 4d 67 2f 54 6b 50 38 6e 5a 38 67 6f 3d 0d 0a 53 Mg/TkP8nZ8go=..S
0009 65 63 2d 57 65 62 53 6f 63 6b 65 74 2d 50 72 6f ec-WebSocket-Pro
0010 74 6f 63 6f 6c 3a 20 63 68 61 74 0d 0a 0d 0a tocol: chat....
Sent OKAY.

Guys.
Here is my experience about the issue.
Yesterday, my php simple chatting socket script worked well in both of firefox and chrome. Suddenly it did not work in chrome today. Not sure why? But after the request header value was printed, I found that the header length was longer than 1024 byte.
(I tested by getting 1024 byte in server.php under a domain without login).
Maybe after I logged into the domain, cache length was added into the http request header.
I increased the length value for socket_read function to 5120 byte before performed handshaking. It was enough value to get full request header.
My problem was solved since server.php handshaking function could validate sec-websocket-key from request header.
Hope other guys to take care of websocket request header length.
Regards,
Yin

Related

Post JSON with R

I have the following body:
{
"engine": "Google",
"data": {
"text": "Hello, world",
"voice": "en-US"
}
}
which the Content-Type header should be application/json and make the request with body as above. How I use the POST function in R? I should receive a response type:
{
"success": true,
"id": "<RFC4122 uuid>"
}
I want to request that last info on this website "soundoftext.com"
I've tried this using the httr package:
url <- "http://soundoftext.com/"
requestBody <- paste0('
{"engine" : "Google",
"data" : [{"text" : "Hello, world",
"voice" : "en-US"]}}')
res <- httr::POST(url = url,
body = requestBody,
encode = "json")
But I cannot get the information detailed in the response. I get this raw data (UTF-8 encoded) at the content.
3c 21 44 4f 43 54 59 50 45 20 68 74 6d 6c 3e 3c 68 74 6d 6c 20 6c 61 6e 67 3d 22 65 6e 22 3e 3c 68 65 61 64 3e 3c 6d 65 74 61 20 63 68 61 72 73 65 74 3d 22 75 74 66 2d 38 22 3e 3c 6d 65 74 61 20 6e 61 6d 65 3d 22 76 69 65 77 70 6f 72 74 22 20 63 6f 6e 74 65 6e 74 3d 22 77 69 64 74 68 3d 64 65 76 69 63 65 2d 77 69 64 74 68 2c 69 6e 69 74 69 61 6c 2d 73 63 61 6c 65 3d 31 2c 73 68 72 69 6e 6b 2d 74 6f 2d 66 69 74 3d 6e 6f 22 3e 3c 6d 65 74 61 20 6e 61 6d 65 3d 22 74 68 65 6d 65 2d 63 6f 6c 6f 72 22 20 63 6f 6e 74 65 6e 74 3d 22 23 30 30 30 30 30 30 22 3e 3c 6c 69 6e 6b 20 72 65 6c 3d 22 6d 61 6e 69 66 65 73 74 22 20 68 72 65 66 3d 22 2f 6d 61 6e 69 66 65 73 74 2e 6a 73 6f 6e 22 3e 3c 6c 69 6e 6b 20 72 65 6c 3d 22 73 68 6f 72 74 63 75 74 20 69 63 6f 6e 22 20 68 72 65 66 3d 22 2f 66 61 76 69 63 6f 6e 2e 69 63 6f 22 3e 3c 6c 69 6e 6b 20 68 72 65 66 3d 22 68 74 74 70 73 3a 2f 2f 66 6f 6e 74 73 2e 67 6f 6f 67 6c 65 61 70 69 73 2e 63 6f 6d 2f 63 73 73 3f 66 61 6d 69 6c 79 3d 4f 70 65 6e 2b 53 61 6e 73 3a 34 30 30 2c 36 30 30 2c 37 30 30 22 20 72 65 6c 3d 22 73 74 79 6c 65 73 68 65 65 74 22 3e 3c 73 63 72 69 70 74 20 73 72 63 3d 22 68 74 74 70 73 3a 2f 2f 63 68 65 63 6b 6f 75 74 2e 73 74 72 69 70 65 2e 63 6f 6d 2f 63 68 65 63 6b 6f 75 74 2e 6a 73 22 3e 3c 2f 73 63 72 69 70 74 3e 3c 74 69 74 6c 65 3e 53 6f 75 6e 64 20 6f 66 20 54 65 78 74 3c 2f 74 69 74 6c 65 3e 3c 6c 69 6e 6b 20 68 72 65 66 3d 22 2f 73 74 61 74 69 63 2f 63 73 73 2f 6d 61 69 6e 2e 31 34 39 38 65 66 36 34 2e 63 73 73 22 20 72 65 6c 3d 22 73 74 79 6c 65 73 68 65 65 74 22 3e 3c 2f 68 65 61 64 3e 3c 62 6f 64 79 3e 3c 6e 6f 73 63 72 69 70 74 3e 59 6f 75 20 6e 65 65 64 20 74 6f 20 65 6e 61 62 6c 65 20 4a 61 76 61 53 63 72 69 70 74 20 74 6f 20 72 75 6e 20 74 68 69 73 20 61 70 70 2e 3c 2f 6e 6f 73 63 72 69 70 74 3e 3c 64 69 76 20 69 64 3d 22 72 6f 6f 74 22 3e 3c 2f 64 69 76 3e 3c 73 63 72 69 70 74 20 74 79 70 65 3d 22 74 65 78 74 2f 6a 61 76 61 73 63 72 69 70 74 22 20 73 72 63 3d 22 2f 73 74 61 74 69 63 2f 6a 73 2f 6d 61 69 6e 2e 37 66 32 30 38 38 64 33 2e 6a 73 22 3e 3c 2f 73 63 72 69 70 74 3e 3c 2f 62 6f 64 79 3e 3c 2f 68 74 6d 6c 3e
Is the information located in this raw data?
Owner of Sound of Text here.
It looks like you are posting to the wrong URL.
You should send your POST request to "https://api.soundoftext.com/sounds".
Try this and let me know the result. I am not familiar with R, but I will do my best to help.
You can see the full documentation for the API here: https://soundoftext.com/docs

Download Firefox browser cache file

I was working on a project and just when I saved the file, my power cut off. Now my html file is corrupted and I have no backup of it.
I just remembered that I might have a cache of it in Firefox. So, first I tried CacheViewer from Firefox official add-ons store. This add-on would install and then required a restart, after the restart it would disappear.
So instead, I tried the old fashioned way. I went to about:cache > Local Storage and whew, I was lucky enough that it was there and wasn't replaced with the blank corrupted html file.
Now I have some sort (Catch Entry Information) of file. The left side has the binary code, while the right side has the proper html code with some unnecessary . periods in it.
This is what my this file looks like:
00000000: 3c 21 64 6f 63 74 79 70 65 20 68 74 6d 6c 3e 0d <!doctype html>.
00000010: 0a 3c 68 74 6d 6c 3e 0d 0a 3c 68 65 61 64 3e 0d .<html>..<head>.
00000020: 0a 3c 6d 65 74 61 20 63 68 61 72 73 65 74 3d 22 .<meta charset="
00000030: 75 74 66 2d 38 22 3e 0d 0a 3c 74 69 74 6c 65 3e utf-8">..<title>
00000040: 46 69 74 41 70 70 3c 2f 74 69 74 6c 65 3e 0d 0a FitApp</title>..
00000050: 3c 73 74 79 6c 65 3e 40 66 6f 6e 74 2d 66 61 63 <style>#font-fac
00000060: 65 20 7b 0a 20 20 66 6f 6e 74 2d 66 61 6d 69 6c e {. font-famil
00000070: 79 3a 20 22 52 6f 62 6f 74 6f 2d 6c 69 67 68 74 y: "Roboto-light
00000080: 22 3b 0a 20 20 73 72 63 3a 20 75 72 6c 28 22 2e ";. src: url(".
00000090: 2e 2f 66 6f 6e 74 73 2f 52 6f 62 6f 74 6f 2d 4c ./fonts/Roboto-L
000000a0: 69 67 68 74 2e 74 66 66 22 29 20 66 6f 72 6d 61 ight.tff") forma
000000b0: 74 28 22 74 72 75 65 74 79 70 65 22 29 2c 20 6c t("truetype"), l
000000c0: 6f 63 61 6c 28 22 52 6f 62 6f 74 6f 2d 6c 69 67 ocal("Roboto-lig
000000d0: 68 74 22 29 20 66 6f 72 6d 61 74 28 22 74 72 75 ht") format("tru
000000e0: 65 74 79 70 65 22 29 3b 0a 20 20 66 6f 6e 74 2d etype");. font-
000000f0: 77 65 69 67 68 74 3a 20 34 30 30 3b 0a 7d 0a 40 weight: 400;.}.#
How do I go about decoding this?
If there is a better way to download a catch file from Mozilla Firefox, please do mention.
Steps:
Copy all of that text into a text document, and save it.
Edit that text to make it only the column of hexadecimal characters.
Options for how to do this include shell commands, a find-replace using regex, or a column editing mode in your text editor.
Convert those hex encoded bytes into a binary file.
You should be able to paste those characters into any decent hex editor, and save it as a file.
BTW, the .'s in this case are substituted to replace the newline characters.

How can I send an HTTP request to my router with a not well-formatted field?

I'm trying to find a way to enable/disable my router whithout the need for manually using the browser. After a bit of snooping, it seems to me that I have to send a request like that [from WireShark]:
0000 9c 97 26 c9 c2 20 b0 48 7a 80 52 9c 08 00 45 00 ..&.. .Hz.R...E.
0010 02 2e 28 89 40 00 80 06 00 00 c0 a8 00 02 c0 a8 ..(.#...........
0020 00 01 d6 a8 00 50 34 fd c9 8d c9 ef dd 2d 50 18 .....P4......-P.
0030 fe da 83 74 00 00 50 4f 53 54 20 2f 77 61 6e 53 ...t..POST /wanS
0040 74 61 74 75 73 2e 6c 70 20 48 54 54 50 2f 31 2e tatus.lp HTTP/1.
0050 31 0d 0a 48 6f 73 74 3a 20 31 39 32 2e 31 36 38 1..Host: 192.168
0060 2e 30 2e 31 0d 0a 55 73 65 72 2d 41 67 65 6e 74 .0.1..User-Agent
0070 3a 20 4d 6f 7a 69 6c 6c 61 2f 35 2e 30 20 28 57 : Mozilla/5.0 (W
0080 69 6e 64 6f 77 73 20 4e 54 20 36 2e 31 3b 20 57 indows NT 6.1; W
0090 4f 57 36 34 3b 20 72 76 3a 33 36 2e 30 29 20 47 OW64; rv:36.0) G
00a0 65 63 6b 6f 2f 32 30 31 30 30 31 30 31 20 46 69 ecko/20100101 Fi
00b0 72 65 66 6f 78 2f 33 36 2e 30 0d 0a 41 63 63 65 refox/36.0..Acce
00c0 70 74 3a 20 74 65 78 74 2f 68 74 6d 6c 2c 61 70 pt: text/html,ap
00d0 70 6c 69 63 61 74 69 6f 6e 2f 78 68 74 6d 6c 2b plication/xhtml+
00e0 78 6d 6c 2c 61 70 70 6c 69 63 61 74 69 6f 6e 2f xml,application/
00f0 78 6d 6c 3b 71 3d 30 2e 39 2c 2a 2f 2a 3b 71 3d xml;q=0.9,*/*;q=
0100 30 2e 38 0d 0a 41 63 63 65 70 74 2d 4c 61 6e 67 0.8..Accept-Lang
0110 75 61 67 65 3a 20 69 74 2d 49 54 2c 69 74 3b 71 uage: it-IT,it;q
0120 3d 30 2e 38 2c 65 6e 2d 55 53 3b 71 3d 30 2e 35 =0.8,en-US;q=0.5
0130 2c 65 6e 3b 71 3d 30 2e 33 0d 0a 41 63 63 65 70 ,en;q=0.3..Accep
0140 74 2d 45 6e 63 6f 64 69 6e 67 3a 20 67 7a 69 70 t-Encoding: gzip
0150 2c 20 64 65 66 6c 61 74 65 0d 0a 44 4e 54 3a 20 , deflate..DNT:
0160 31 0d 0a 52 65 66 65 72 65 72 3a 20 68 74 74 70 1..Referer: http
0170 3a 2f 2f 31 39 32 2e 31 36 38 2e 30 2e 31 2f 77 ://192.168.0.1/w
0180 61 6e 53 74 61 74 75 73 2e 6c 70 0d 0a 43 6f 6f anStatus.lp..Coo
0190 6b 69 65 3a 20 78 41 75 74 68 5f 53 45 53 53 49 kie: xAuth_SESSI
01a0 4f 4e 5f 49 44 3d 49 4d 45 74 4f 38 44 4c 45 73 ON_ID=IMEtO8DLEs
01b0 51 70 6d 54 77 69 64 67 43 59 6c 51 41 3d 0d 0a QpmTwidgCYlQA=..
01c0 43 6f 6e 6e 65 63 74 69 6f 6e 3a 20 6b 65 65 70 Connection: keep
01d0 2d 61 6c 69 76 65 0d 0a 43 6f 6e 74 65 6e 74 2d -alive..Content-
01e0 54 79 70 65 3a 20 61 70 70 6c 69 63 61 74 69 6f Type: applicatio
01f0 6e 2f 78 2d 77 77 77 2d 66 6f 72 6d 2d 75 72 6c n/x-www-form-url
0200 65 6e 63 6f 64 65 64 0d 0a 43 6f 6e 74 65 6e 74 encoded..Content
0210 2d 4c 65 6e 67 74 68 3a 20 32 39 0d 0a 0d 0a 72 -Length: 29....r
0220 6e 3d 49 4d 45 74 4f 38 44 4c 45 73 51 70 6d 54 n=IMEtO8DLEsQpmT
0230 77 69 64 67 43 59 6c 51 41 25 33 44 widgCYlQA%3D
As you can see, it ends with 'rn=IMEtO8DLEsQpmTwidgCYlQA%3D', that is the session cookie.
Putting a 'normal' request the router goes back to index instead of performing the action, probably for the lack of 'rn=IMEtO8DLEsQpmTwidgCYlQA%3D'.
Until now, I tried using Wget (under windows...) but I can't find a way to add the last info.
So I would know if
there is a way to add an header that is not header-compliant (use of = instead of : ) using wGet or if
there is a tool more suited for that task (I'm looking for cUrl but I don't think it acts different from wGet).
The batch file (plain ol' DOS) I wrote for testing wGet is:
#title %~n0
#cls
#set _wget="C:\Program Files (x86)\GnuWin32\bin\wget"
#set _url=http://192.168.0.1/
#set _urls=http://192.168.0.1/standard.lp
#set _urlw=http://192.168.0.1/wanStatus.lp
#set _post=--post-data="/wanStatus.lp HTTP/1.1"
#set _cook=./cookies.txt
#set _hdr1="Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
#set _hdr2="Accept-Language: it-IT,it;q=0.8,en-US;q=0.5,en;q=0.3"
#set _hdr3="Accept-Encoding: gzip, deflate"
#set _hdr4="DNT: 1"
#set _agnt="Mozilla/5.0 (Windows NT 6.1; WOW64; rv:36.0) Gecko/20100101 Firefox/36.0"
#set _rfr="Referer: http://192.168.0.1/wanStatus.lp"
#set _opt=--server-response --timestamping --user-agent=%_agnt% --keep-session-cookies --referer=%_rfr% --save-headers --header=%_hdr1% --header=%_hdr2% --header=%_hdr3% --header=%_hdr4% --debug
%_wget% %_opt% --save-cookies %_cook% %_url%
%_wget% %_opt% --load-cookies %_cook% %_urlw%
#FOR /F "eol=# tokens=1,6,7* delims= " %%i in (F:\wget\cookies.txt) do #(
#echo i=%%i j=%%j k=%%k l=%%l
#set _ckhost=%%i
#set _ckname=%%j
#set _ckval=%%k
)
#echo host=%_ckhost% cookie name=%_ckname% value=%_ckval%
#if "%_ckname%"=="xAuth_SESSION_ID" set _rn=rn=%_ckval%
#if "%_rn:~-1%"=="=" set _rn=%_rn:~0,-1%%%3D
#echo _rn='%_rn%'
%_wget% %_opt% --load-cookies %_cook% %_post% --header="%_rn%" %_url%
but it ends up this way:
F:\wget>"C:\Program Files (x86)\GnuWin32\bin\wget" --server-response --timestamping --user-agent="Mozilla/5.0 (Windows NT 6.1; WOW64; rv:36.0) Gecko/20100101 Firefox/36.0" --keep-session-cookies --referer="Referer: http://192.168.0.1/wanStatus.lp" --save-headers --header="Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" --header="Accept-Language: it-IT,it;q=0.8,en-US;q=0.5,en;q=0.3" --header="Accept-Encoding: gzip, deflate" --header="DNT: 1" --debug --load-cookies ./cookies.txt --post-data="/wanStatus.lp HTTP/1.1" --header="rn=MGyN4YpepJoE6kSXPVT9lgA%3D" http://192.168.0.1/
SYSTEM_WGETRC = c:/progra~1/wget/etc/wgetrc
syswgetrc = C:\Program Files (x86)\GnuWin32/etc/wgetrc
Setting --load-cookies (loadcookies) to ./cookies.txt
Setting --post-data (postdata) to /wanStatus.lp HTTP/1.1
Setting --header (header) to rn=MGyN4YpepJoE6kSXPVT9lgA%3D
C:\Program Files (x86)\GnuWin32\bin\wget: --header: intestazione "rn=MGyN4YpepJoE6kSXPVT9lgA%3D" non valida.
Thank you very much for any suggestion! Or for links pointing to pages where I can find a solution (I spent a looot of time googling around...).
Luca
Note: I think it's useless to add here the HTML and JS code of the page in the router that generate the line rn=MGyN4YpepJoE6kSXPVT9lgA%3D, but if you need it, I can report it.
Look careful at the captured data and you might notice that these data are not part of the header. The header ends with \r\n\r\n (Bytes 021b..021e) and your "session cookie" is not a cookie (which would be part of the header) but the body of the POST request. Thus you need to use --post-data 'rn=MGyN...'

solr does not insert the first line in the csv file

When a csv file is uploaded over curl command as below
C:\>curl "http://localhost:8983/solr/update/csv?commit=true&stream.file=C:\dev\tools\solr-4.7.2\data.txt&stream.contentType=text/csv&header=false&fieldnames=id,cat,pubyear_i,title,author,
series_s,sequence_i&skipLines=0"
and data.txt content is as below
book1,fantasy,2000,A Storm of Swords,George R.R. Martin,A Song of Ice and Fire,3
book2,fantasy,2005,A Feast for Crows,George R.R. Martin,A Song of Ice and Fire,4
book3,fantasy,2011,A Dance with Dragons,George R.R. Martin,A Song of Ice and Fire,5
book4,sci-fi,1987,Consider Phlebas,Iain M. Banks,The Culture,1
book5,sci-fi,1988,The Player of Games,Iain M. Banks,The Culture,2
book6,sci-fi,1990,Use of Weapons,Iain M. Banks,The Culture,3
book7,fantasy,1984,Shadows Linger,Glen Cook,The Black Company,2
book8,fantasy,1984,The White Rose,Glen Cook,The Black Company,3
book9,fantasy,1989,Shadow Games,Glen Cook,The Black Company,4
book10,sci-fi,2001,Gridlinked,Neal Asher,Ian Cormac,1
book11,sci-fi,2003,The Line of Polity,Neal Asher,Ian Cormac,2
book12,sci-fi,2005,Brass Man,Neal Asher,Ian Cormac,3
first data in data.txt file is not being inserted to Solr which its id is "book1". Can someone please tell why?
http://localhost:8983/solr/query?q=id:book1
{
"responseHeader":{
"status":0,
"QTime":1,
"params":{
"q":"id:book1"}},
"response":{"numFound":0,"start":0,"docs":[]
}}
Solr logs already tells that book1 is being added.
15440876 [searcherExecutor-5-thread-1] INFO org.apache.solr.core.SolrCore û [collection1] Registered new searcher Searcher#177fcdf1[collection1] main{StandardDirectoryReader(segments_1g:124:nrt _z(4.7):C12)}
15440877 [qtp84034882-11] INFO org.apache.solr.update.processor.LogUpdateProcessor û [collection1] webapp=/solr path=/update params={fieldnames=id,cat,pubyear_i,title,author,series_s,sequence_i&skipLines=0&commit=true&stream.con
tentType=text/csv&header=false&stream.file=C:\dev\tools\solr-4.7.2\data.txt} {add=[?book1 (1480070032327180288), book2 (1480070032332423168), book3 (1480070032335568896), book4 (1480070032337666048), book5 (1480070032339763200), b
ook6 (1480070032341860352), book7 (1480070032343957504), book8 (1480070032347103232), book9 (1480070032349200384), book10 (1480070032351297536), ... (12 adds)],commit=} 0 92
If I ask for all data then below you can also see book1 is still missing
http://localhost:8983/solr/query?q=id:book*&sort=pubyear_i+desc&fl=id,title,pubyear_i&rows=15
{
"responseHeader":{
"status":0,
"QTime":1,
"params":{
"fl":"id,title,pubyear_i",
"sort":"pubyear_i desc",
"q":"id:book*",
"rows":"15"}},
"response":{"numFound":11,"start":0,"docs":[
{
"id":"book3",
"pubyear_i":2011,
"title":["A Dance with Dragons"]},
{
"id":"book2",
"pubyear_i":2005,
"title":["A Feast for Crows"]},
{
"id":"book12",
"pubyear_i":2005,
"title":["Brass Man"]},
{
"id":"book11",
"pubyear_i":2003,
"title":["The Line of Polity"]},
{
"id":"book10",
"pubyear_i":2001,
"title":["Gridlinked"]},
{
"id":"book6",
"pubyear_i":1990,
"title":["Use of Weapons"]},
{
"id":"book9",
"pubyear_i":1989,
"title":["Shadow Games"]},
{
"id":"book5",
"pubyear_i":1988,
"title":["The Player of Games"]},
{
"id":"book4",
"pubyear_i":1987,
"title":["Consider Phlebas"]},
{
"id":"book7",
"pubyear_i":1984,
"title":["Shadows Linger"]},
{
"id":"book8",
"pubyear_i":1984,
"title":["The White Rose"]}]
}}
data.txt context by hex data
0000000 ef bb bf 62 6f 6f 6b 31 2c 66 61 6e 74 61 73 79
0000020 2c 32 30 30 30 2c 41 20 53 74 6f 72 6d 20 6f 66
0000040 20 53 77 6f 72 64 73 2c 47 65 6f 72 67 65 20 52
0000060 2e 52 2e 20 4d 61 72 74 69 6e 2c 41 20 53 6f 6e
0000100 67 20 6f 66 20 49 63 65 20 61 6e 64 20 46 69 72
0000120 65 2c 33 0d 0a 62 6f 6f 6b 32 2c 66 61 6e 74 61
0000140 73 79 2c 32 30 30 35 2c 41 20 46 65 61 73 74 20
0000160 66 6f 72 20 43 72 6f 77 73 2c 47 65 6f 72 67 65
0000200 20 52 2e 52 2e 20 4d 61 72 74 69 6e 2c 41 20 53
0000220 6f 6e 67 20 6f 66 20 49 63 65 20 61 6e 64 20 46
0000240 69 72 65 2c 34 0d 0a 62 6f 6f 6b 33 2c 66 61 6e
0000260 74 61 73 79 2c 32 30 31 31 2c 41 20 44 61 6e 63
0000300 65 20 77 69 74 68 20 44 72 61 67 6f 6e 73 2c 47
0000320 65 6f 72 67 65 20 52 2e 52 2e 20 4d 61 72 74 69
0000340 6e 2c 41 20 53 6f 6e 67 20 6f 66 20 49 63 65 20
0000360 61 6e 64 20 46 69 72 65 2c 35 0d 0a 62 6f 6f 6b
0000400 34 2c 73 63 69 2d 66 69 2c 31 39 38 37 2c 43 6f
0000420 6e 73 69 64 65 72 20 50 68 6c 65 62 61 73 2c 49
0000440 61 69 6e 20 4d 2e 20 42 61 6e 6b 73 2c 54 68 65
0000460 20 43 75 6c 74 75 72 65 2c 31 0d 0a 62 6f 6f 6b
0000500 35 2c 73 63 69 2d 66 69 2c 31 39 38 38 2c 54 68
0000520 65 20 50 6c 61 79 65 72 20 6f 66 20 47 61 6d 65
0000540 73 2c 49 61 69 6e 20 4d 2e 20 42 61 6e 6b 73 2c
0000560 54 68 65 20 43 75 6c 74 75 72 65 2c 32 0d 0a 62
0000600 6f 6f 6b 36 2c 73 63 69 2d 66 69 2c 31 39 39 30
0000620 2c 55 73 65 20 6f 66 20 57 65 61 70 6f 6e 73 2c
0000640 49 61 69 6e 20 4d 2e 20 42 61 6e 6b 73 2c 54 68
0000660 65 20 43 75 6c 74 75 72 65 2c 33 0d 0a 62 6f 6f
0000700 6b 37 2c 66 61 6e 74 61 73 79 2c 31 39 38 34 2c
0000720 53 68 61 64 6f 77 73 20 4c 69 6e 67 65 72 2c 47
0000740 6c 65 6e 20 43 6f 6f 6b 2c 54 68 65 20 42 6c 61
0000760 63 6b 20 43 6f 6d 70 61 6e 79 2c 32 0d 0a 62 6f
0001000 6f 6b 38 2c 66 61 6e 74 61 73 79 2c 31 39 38 34
0001020 2c 54 68 65 20 57 68 69 74 65 20 52 6f 73 65 2c
0001040 47 6c 65 6e 20 43 6f 6f 6b 2c 54 68 65 20 42 6c
0001060 61 63 6b 20 43 6f 6d 70 61 6e 79 2c 33 0d 0a 62
0001100 6f 6f 6b 39 2c 66 61 6e 74 61 73 79 2c 31 39 38
0001120 39 2c 53 68 61 64 6f 77 20 47 61 6d 65 73 2c 47
0001140 6c 65 6e 20 43 6f 6f 6b 2c 54 68 65 20 42 6c 61
0001160 63 6b 20 43 6f 6d 70 61 6e 79 2c 34 0d 0a 62 6f
0001200 6f 6b 31 30 2c 73 63 69 2d 66 69 2c 32 30 30 31
0001220 2c 47 72 69 64 6c 69 6e 6b 65 64 2c 4e 65 61 6c
0001240 20 41 73 68 65 72 2c 49 61 6e 20 43 6f 72 6d 61
0001260 63 2c 31 0d 0a 62 6f 6f 6b 31 31 2c 73 63 69 2d
0001300 66 69 2c 32 30 30 33 2c 54 68 65 20 4c 69 6e 65
0001320 20 6f 66 20 50 6f 6c 69 74 79 2c 4e 65 61 6c 20
0001340 41 73 68 65 72 2c 49 61 6e 20 43 6f 72 6d 61 63
0001360 2c 32 0d 0a 62 6f 6f 6b 31 32 2c 73 63 69 2d 66
0001400 69 2c 32 30 30 35 2c 42 72 61 73 73 20 4d 61 6e
0001420 2c 4e 65 61 6c 20 41 73 68 65 72 2c 49 61 6e 20
0001440 43 6f 72 6d 61 63 2c 33 0d 0a
0001452
Look closely at the log... it says that "?book1" was added (notice the question mark in the ID).
My best guess is that there are some funny characters at the start of the file that become part of the ID. Perhaps a BOM (I know some text editors annoyingly add that). http://en.wikipedia.org/wiki/Byte_order_mark
You could verify something is there by using "hexdump data.txt" or "od -tx1 data.txt"
You could also try a different text editor that would allow you to delete that.
It looks like the first line gets treated as a header.
But you do have header parameter. I would check it is spelt correctly, maybe move it earlier in the parameter list. Check that solrconfig.xml does not override that value.
Also, if you are using Solr 4+, try skipping the /csv bit at the end of the URL. It's a legacy address and maybe it has some expectations about the header line.

HTTP malformed packet exception

I'm developing a proxy in node.js. I have developed an addon which analyses packets and almost always changes the packets' length. Here is the code:
var http = require('http');
var eamorr=require('./Eamorr_addon/out/Release/Eamorr_addon');
http.createServer(function(request,response){
var proxy=http.createClient(80,request.headers['host']);
var proxy_request=proxy.request(request.method,request.url,request.headers);
proxy_request.addListener('response',function(proxy_response){
proxy_response.addListener('data',function(chunk){
var x=eamorr.analyse(chunk);
if(proxy_response.headers['content-length'] || proxy_response.headers['Content-Length']){
proxy_response.headers['content-length']=x.length;
}
response.writeHead(proxy_response.statusCode,proxy_response.headers);
response.write(x,'binary');
});
proxy_response.addListener('end',function(){
response.end();
});
});
request.addListener('data',function(chunk){
proxy_request.write(chunk,'binary');
});
request.addListener('end',function(){
proxy_request.end();
});
}).listen(10002);
The problem is, I keep getting malformed http packets on the receiving end. It works fine for packets with a defined content-length, but not for chunked responses.
Here is a dump from Wireshark which shows up as a malformed packet for some reason I can't get to the bottom of:
0000 48 54 54 50 2f 31 2e 31 20 32 30 30 20 4f 4b 0d HTTP/1.1 200 OK.
0010 0a 64 61 74 65 3a 20 4d 6f 6e 2c 20 32 37 20 46 .date: M on, 27 F
0020 65 62 20 32 30 31 32 20 30 38 3a 32 31 3a 33 38 eb 2012 08:21:38
0030 20 47 4d 54 0d 0a 65 78 70 69 72 65 73 3a 20 2d GMT..ex pires: -
0040 31 0d 0a 63 61 63 68 65 2d 63 6f 6e 74 72 6f 6c 1..cache -control
0050 3a 20 70 72 69 76 61 74 65 2c 20 6d 61 78 2d 61 : privat e, max-a
0060 67 65 3d 30 0d 0a 63 6f 6e 74 65 6e 74 2d 74 79 ge=0..co ntent-ty
0070 70 65 3a 20 74 65 78 74 2f 68 74 6d 6c 3b 20 63 pe: text /html; c
0080 68 61 72 73 65 74 3d 55 54 46 2d 38 0d 0a 73 65 harset=U TF-8..se
0090 72 76 65 72 3a 20 67 77 73 0d 0a 78 2d 78 73 73 rver: gw s..x-xss
00a0 2d 70 72 6f 74 65 63 74 69 6f 6e 3a 20 31 3b 20 -protect ion: 1;
00b0 6d 6f 64 65 3d 62 6c 6f 63 6b 0d 0a 78 2d 66 72 mode=blo ck..x-fr
00c0 61 6d 65 2d 6f 70 74 69 6f 6e 73 3a 20 53 41 4d ame-opti ons: SAM
00d0 45 4f 52 49 47 49 4e 0d 0a 74 72 61 6e 73 66 65 EORIGIN. .transfe
00e0 72 2d 65 6e 63 6f 64 69 6e 67 3a 20 63 68 75 6e r-encodi ng: chun
00f0 6b 65 64 0d 0a 43 6f 6e 6e 65 63 74 69 6f 6e 3a ked..Con nection:
0100 20 6b 65 65 70 2d 61 6c 69 76 65 0d 0a 0d 0a 34 keep-al ive....4
0110 39 65 0d 0a 0a fd 09 08 00 11 00 00 00 00 00 00 9e...... ........
0120 00 00 1a fd 09 3c 21 64 6f 63 74 79 70 65 20 68 .....<!d octype h
0130 74 6d 6c 3e 3c 68 74 6d 6c 20 69 74 65 6d 73 63 tml><htm l itemsc
0140 6f 70 65 20 69 74 65 6d 74 79 70 65 3d 22 68 74 ope item type="ht
0150 74 70 3a 2f 2f 73 63 68 65 6d 61 2e 6f 72 67 2f tp://sch ema.org/
0160 57 65 62 50 61 67 65 22 3e 3c 68 65 61 64 3e 3c WebPage" ><head><
0170 6d 65 74 61 20 68 74 74 70 2d 65 71 75 69 76 3d meta htt p-equiv=
0180 22 63 6f 6e 74 65 6e 74 2d 74 79 70 65 22 20 63 "content -type" c
0190 6f 6e 74 65 6e 74 3d 22 74 65 78 74 2f 68 74 6d ontent=" text/htm
01a0 6c 3b 20 63 68 61 72 73 65 74 3d 55 54 46 2d 38 l; chars et=UTF-8
01b0 22 3e 3c 6d 65 74 61 20 69 74 65 6d 70 72 6f 70 "><meta itemprop
01c0 3d 22 69 6d 61 67 65 22 20 63 6f 6e 74 65 6e 74 ="image" content
01d0 3d 22 2f 69 6d 61 67 65 73 2f 67 6f 6f 67 6c 65 ="/image s/google
01e0 5f 66 61 76 69 63 6f 6e 5f 31 32 38 2e 70 6e 67 _favicon _128.png
01f0 22 3e 3c 74 69 74 6c 65 3e 47 6f 6f 67 6c 65 3c "><title >Google<
0200 2f 74 69 74 6c 65 3e 3c 73 63 72 69 70 74 3e 77 /title>< script>w
0210 69 6e 64 6f 77 2e 67 6f 6f 67 6c 65 3d 7b 6b 45 indow.go ogle={kE
0220 49 3a 22 45 6a 31 4c 54 5f 72 38 4e 64 43 32 68 I:"Ej1LT _r8NdC2h
0230 41 66 58 5f 4b 32 4c 44 67 22 2c 67 65 74 45 49 AfX_K2LD g",getEI
0240 3a 66 75 6e 63 74 69 6f 6e 28 61 29 7b 76 61 72 :functio n(a){var
0250 20 64 3b 77 68 69 6c 65 28 61 26 26 21 28 61 2e d;while (a&&!(a.
0260 67 65 74 41 74 74 72 69 62 75 74 65 26 26 28 64 getAttri bute&&(d
0270 3d 61 2e 67 65 74 41 74 74 72 69 62 75 74 65 28 =a.getAt tribute(
0280 22 65 69 64 22 29 29 29 29 61 3d 61 2e 70 61 72 "eid"))) )a=a.par
0290 65 6e 74 4e 6f 64 65 3b 72 65 74 75 72 6e 20 64 entNode; return d
02a0 7c 7c 67 6f 6f 67 6c 65 2e 6b 45 49 7d 2c 68 74 ||google .kEI},ht
02b0 74 70 73 3a 66 75 6e 63 74 69 6f 6e 28 29 7b 72 tps:func tion(){r
02c0 65 74 75 72 6e 20 77 69 6e 64 6f 77 2e 6c 6f 63 eturn wi ndow.loc
02d0 61 74 69 6f 6e 2e 70 72 6f 74 6f 63 6f 6c 3d 3d ation.pr otocol==
02e0 22 68 74 74 70 73 3a 22 7d 2c 6b 45 58 50 49 3a "https:" },kEXPI:
02f0 22 33 31 32 31 35 2c 33 33 35 35 31 2c 33 34 33 "31215,3 3551,343
0300 32 34 2c 33 34 39 30 34 2c 33 35 30 35 35 2c 33 24,34904 ,35055,3
0310 35 32 31 33 2c 33 36 36 30 34 2c 33 36 36 38 33 5213,366 04,36683
0320 2c 33 36 39 34 32 2c 33 37 30 31 37 2c 33 37 31 ,36942,3 7017,371
0330 30 32 22 2c 6b 43 53 49 3a 7b 65 3a 22 33 31 32 02",kCSI :{e:"312
0340 31 35 2c 33 33 35 35 31 2c 33 34 33 32 34 2c 33 15,33551 ,34324,3
0350 34 39 30 34 2c 33 35 30 35 35 2c 33 35 32 31 33 4904,350 55,35213
0360 2c 33 36 36 30 34 2c 33 36 36 38 33 2c 33 36 39 ,36604,3 6683,369
0370 34 32 2c 33 37 30 31 37 2c 33 37 31 30 32 22 2c 42,37017 ,37102",
0380 65 69 3a 22 45 6a 31 4c 54 5f 72 38 4e 64 43 32 ei:"Ej1L T_r8NdC2
0390 68 41 66 58 5f 4b 32 4c 44 67 22 7d 2c 61 75 74 hAfX_K2L Dg"},aut
03a0 68 75 73 65 72 3a 30 2c 0a 6d 6c 3a 66 75 6e 63 huser:0, .ml:func
03b0 74 69 6f 6e 28 29 7b 7d 2c 70 61 67 65 53 74 61 tion(){} ,pageSta
03c0 74 65 3a 22 23 22 2c 6b 48 4c 3a 22 65 6e 22 2c te:"#",k HL:"en",
03d0 74 69 6d 65 3a 66 75 6e 63 74 69 6f 6e 28 29 7b time:fun ction(){
03e0 72 65 74 75 72 6e 28 6e 65 77 20 44 61 74 65 29 return(n ew Date)
03f0 2e 67 65 74 54 69 6d 65 28 29 7d 2c 6c 6f 67 3a .getTime ()},log:
0400 66 75 6e 63 74 69 6f 6e 28 61 2c 64 2c 66 2c 68 function (a,d,f,h
0410 29 7b 76 61 72 20 65 3d 6e 65 77 20 49 6d 61 67 ){var e= new Imag
0420 65 2c 67 3d 67 6f 6f 67 6c 65 2c 6b 3d 67 2e 6c e,g=goog le,k=g.l
0430 63 2c 69 3d 67 2e 6c 69 2c 6d 3d 22 22 3b 65 2e c,i=g.li ,m="";e.
0440 6f 6e 65 72 72 6f 72 3d 28 65 2e 6f 6e 6c 6f 61 onerror= (e.onloa
0450 64 3d 28 65 2e 6f 6e 61 62 6f 72 74 3d 66 75 6e d=(e.ona bort=fun
0460 63 74 69 6f 6e 28 29 7b 64 65 6c 65 74 65 20 6b ction(){ delete k
0470 5b 69 5d 7d 29 29 3b 6b 5b 69 5d 3d 65 3b 69 66 [i]}));k [i]=e;if
0480 28 21 66 26 26 64 2e 73 65 61 72 63 68 28 22 26 (!f&&d.s earch("&
0490 65 69 3d 22 29 3d 3d 2d 31 29 6d 3d 22 26 65 69 ei=")==- 1)m="&ei
04a0 3d 22 2b 67 6f 6f 67 6c 65 2e 67 65 74 45 49 28 ="+googl e.getEI(
04b0 68 29 3b 76 61 72 20 6a 3d 66 7c 7c 22 2f 67 65 h);var j =f||"/ge
04c0 6e 5f 32 30 34 3f 61 74 79 70 3d 69 26 63 74 3d n_204?at yp=i&ct=
04d0 22 2b 61 2b 22 26 63 61 64 3d 22 2b 64 2b 6d 2b "+a+"&ca d="+d+m+
04e0 22 26 7a 78 3d 22 2b 67 6f 6f 67 6c 65 2e 74 69 "&zx="+g oogle.ti
04f0 6d 65 28 29 2c 62 3d 2f 5e 68 74 74 70 3a 2f 69 me(),b=/ ^http:/i
0500 3b 69 66 28 62 2e 74 65 73 74 28 6a 29 26 26 67 ;if(b.te st(j)&&g
0510 6f 6f 67 6c 65 2e 68 74 74 70 73 28 29 29 7b 67 oogle.ht tps()){g
0520 6f 6f 67 6c 65 2e 6d 6c 28 6e 65 77 20 45 72 72 oogle.ml (new Err
0530 6f 72 28 22 47 4c 4d 4d 22 29 2c 66 61 6c 73 65 or("GLMM "),false
0540 2c 7b 73 72 63 3a 6a 7d 29 3b 0a 64 65 6c 65 74 ,{src:j} );.delet
0550 65 20 6b 5b 69 5d 3b 72 65 74 75 72 6e 7d 65 2e e k[i];r eturn}e.
0560 73 72 63 3d 6a 3b 67 2e 6c 69 3d 69 2b 31 7d 2c src=j;g. li=i+1},
0570 6c 63 3a 5b 5d 2c 6c 69 3a 30 2c 6a 3a 7b 65 6e lc:[],li :0,j:{en
0580 3a 31 2c 6c 3a 66 75 6e 63 74 69 6f 6e 28 29 7b :1,l:fun ction(){
0590 67 6f 6f 67 6c 65 2e 66 6c 3d 74 72 75 65 7d 2c google.f l=true},
05a0 65 3a 66 75 6e 63 74 69 6f 6e 28 29 7b 67 6f 6f e:functi on(){goo
05b0 67 6c 0d 0a 48 54 54 50 2f 31 2e 31 20 32 30 30 gl..HTTP /1.1 200
05c0 20 4f 4b 0d 0a 64 61 74 65 3a 20 4d 6f 6e 2c 20 OK..dat e: Mon,
05d0 32 37 20 46 65 62 20 32 30 31 32 20 30 38 3a 32 27 Feb 2 012 08:2
05e0 31 3a 33 38 20 47 4d 54 0d 0a 65 78 70 69 72 65 1:38 GMT ..expire
05f0 73 3a 20 2d 31 0d 0a 63 61 63 68 65 2d 63 6f 6e s: -1..c ache-con
0600 74 72 6f 6c 3a 20 70 72 69 76 61 74 65 2c 20 6d trol: pr ivate, m
0610 61 78 2d 61 67 65 3d 30 0d 0a 63 6f 6e 74 65 6e ax-age=0 ..conten
0620 74 2d 74 79 70 65 3a 20 74 65 78 74 2f 68 74 6d t-type: text/htm
0630 6c 3b 20 63 68 61 72 73 65 74 3d 55 54 46 2d 38 l; chars et=UTF-8
0640 0d 0a 73 65 72 76 65 72 3a 20 67 77 73 0d 0a 78 ..server : gws..x
0650 2d 78 73 73 2d 70 72 6f 74 65 63 74 69 6f 6e 3a -xss-pro tection:
0660 20 31 3b 20 6d 6f 64 65 3d 62 6c 6f 63 6b 0d 0a 1; mode =block..
0670 78 2d 66 72 61 6d 65 2d 6f 70 74 69 6f 6e 73 3a x-frame- options:
0680 20 53 41 4d 45 4f 52 49 47 49 4e 0d 0a 74 72 61 SAMEORI GIN..tra
0690 6e 73 66 65 72 2d 65 6e 63 6f 64 69 6e 67 3a 20 nsfer-en coding:
06a0 63 68 75 6e 6b 65 64 0d 0a 43 6f 6e 6e 65 63 74 chunked. .Connect
06b0 69 6f 6e 3a 20 6b 65 65 70 2d 61 6c 69 76 65 0d ion: kee p-alive.
06c0 0a 0d 0a 62 32 35 0d 0a 0a fd 16 08 00 11 00 00 ...b25.. ........
06d0 00 00 00 00 00 00 1a fd 16 65 2e 66 6c 3d 74 72 ........ .e.fl=tr
06e0 75 65 7d 2c 62 3a 6c 6f 63 61 74 69 6f 6e 2e 68 ue},b:lo cation.h
06f0 61 73 68 26 26 6c 6f 63 61 74 69 6f 6e 2e 68 61 ash&&loc ation.ha
0700 73 68 21 3d 22 23 22 2c 62 76 3a 32 31 2c 63 66 sh!="#", bv:21,cf
0710 3a 22 6f 73 62 22 2c 70 6d 3a 22 70 22 2c 70 6c :"osb",p m:"p",pl
0720 3a 5b 5d 2c 6d 63 3a 30 2c 73 63 3a 30 2e 35 2c :[],mc:0 ,sc:0.5,
0730 75 3a 22 65 64 30 31 37 30 65 35 22 7d 2c 54 6f u:"ed017 0e5"},To
0740 6f 6c 62 65 6c 74 3a 7b 7d 2c 79 3a 7b 7d 2c 78 olbelt:{ },y:{},x
0750 3a 66 75 6e 63 74 69 6f 6e 28 61 2c 64 29 7b 67 :functio n(a,d){g
0760 6f 6f 67 6c 65 2e 79 5b 61 2e 69 64 5d 3d 0a 5b oogle.y[ a.id]=.[
0770 61 2c 64 5d 3b 72 65 74 75 72 6e 20 66 61 6c 73 a,d];ret urn fals
0780 65 7d 7d 3b 28 66 75 6e 63 74 69 6f 6e 28 29 7b e}};(fun ction(){
0790 76 61 72 20 61 3d 67 6f 6f 67 6c 65 2e 6a 3b 77 var a=go ogle.j;w
07a0 69 6e 64 6f 77 2e 6f 6e 70 6f 70 73 74 61 74 65 indow.on popstate
07b0 3d 0a 66 75 6e 63 74 69 6f 6e 28 29 7b 61 2e 70 =.functi on(){a.p
07c0 73 63 3d 31 7d 3b 66 6f 72 28 76 61 72 20 64 3d sc=1};fo r(var d=
07d0 30 2c 66 3b 66 3d 5b 22 61 64 22 2c 22 62 63 22 0,f;f=[" ad","bc"
07e0 2c 22 69 6e 70 72 22 2c 22 69 73 22 2c 22 70 22 ,"inpr", "is","p"
07f0 2c 22 70 61 22 2c 22 61 63 22 2c 22 70 63 22 2c ,"pa","a c","pc",
0800 22 70 61 68 22 2c 22 70 68 22 2c 22 73 61 22 2c "pah","p h","sa",
0810 22 73 69 66 70 22 2c 22 73 6c 70 22 2c 22 73 70 "sifp"," slp","sp
0820 66 22 2c 22 73 70 6e 22 2c 22 78 78 22 2c 22 7a f","spn" ,"xx","z
0830 63 22 2c 22 7a 7a 22 5d 5b 64 2b 2b 5d 3b 29 28 c","zz"] [d++];)(
0840 66 75 6e 63 74 69 6f 6e 28 68 29 7b 61 5b 68 5d function (h){a[h]
0850 3d 66 75 6e 63 74 69 6f 6e 28 29 7b 61 2e 70 6c =functio n(){a.pl
0860 2e 70 75 73 68 28 5b 68 2c 61 72 67 75 6d 65 6e .push([h ,argumen
0870 74 73 5d 29 7d 7d 29 28 66 29 7d 29 28 29 3b 69 ts])}})( f)})();i
0880 66 28 21 77 69 6e 64 6f 77 2e 63 68 72 6f 6d 65 f(!windo w.chrome
0890 29 77 69 6e 64 6f 77 2e 63 68 72 6f 6d 65 3d 7b )window. chrome={
08a0 7d 3b 77 69 6e 64 6f 77 2e 63 68 72 6f 6d 65 2e };window .chrome.
08b0 73 76 3d 31 2e 30 30 3b 28 66 75 6e 63 74 69 6f sv=1.00; (functio
08c0 6e 28 29 7b 76 61 72 20 61 3d 0a 67 6f 6f 67 6c n(){var a=.googl
08d0 65 2e 6b 45 49 3b 77 69 6e 64 6f 77 2e 70 70 5f e.kEI;wi ndow.pp_
08e0 74 6f 73 3d 7b 7d 3b 76 61 72 20 64 3d 64 6f 63 tos={};v ar d=doc
08f0 75 6d 65 6e 74 2e 64 6f 6d 61 69 6e 2e 72 65 70 ument.do main.rep
0900 6c 61 63 65 28 2f 2e 2a 3f 28 67 6f 6f 67 6c 65 lace(/.* ?(google
0910 5c 2e 2e 2a 29 2f 2c 22 24 31 22 29 3b 66 75 6e \..*)/," $1");fun
0920 63 74 69 6f 6e 20 66 28 29 7b 76 61 72 20 62 3d ction f( ){var b=
0930 30 3b 74 72 79 7b 76 61 72 20 63 3d 64 6f 63 75 0;try{va r c=docu
0940 6d 65 6e 74 2e 63 6f 6f 6b 69 65 2e 6d 61 74 63 ment.coo kie.matc
0950 68 28 2f 50 50 5f 54 4f 53 5f 41 43 4b 3d 28 5b h(/PP_TO S_ACK=([
0960 5e 3b 5d 2a 29 2f 29 3b 62 3d 63 26 26 21 69 73 ^;]*)/); b=c&&!is
0970 4e 61 4e 28 63 5b 31 5d 29 3f 63 5b 31 5d 3a 30 NaN(c[1] )?c[1]:0
0980 7d 63 61 74 63 68 28 6c 29 7b 65 28 22 65 72 72 }catch(l ){e("err
0990 6f 72 22 2c 22 72 65 61 64 5f 63 6f 6f 6b 69 65 or","rea d_cookie
09a0 22 29 7d 72 65 74 75 72 6e 20 62 7d 66 75 6e 63 ")}retur n b}func
09b0 74 69 6f 6e 20 68 28 62 29 7b 76 61 72 20 63 3d tion h(b ){var c=
09c0 66 28 29 3b 69 66 28 63 3e 3d 30 29 7b 67 28 2b f();if(c >=0){g(+
09d0 2b 63 29 3b 69 66 28 66 28 29 3e 30 26 26 21 62 +c);if(f ()>0&&!b
09e0 29 6d 28 29 7d 7d 66 75 6e 63 74 69 6f 6e 20 65 )m()}}fu nction e
09f0 28 62 2c 63 29 7b 76 61 72 20 6c 3d 6e 65 77 20 (b,c){va r l=new
0a00 49 6d 61 67 65 3b 63 3d 63 3f 22 26 65 6d 73 67 Image;c= c?"&emsg
0a10 3d 22 2b 63 3a 22 22 3b 6c 2e 73 72 63 3d 5b 22 ="+c:""; l.src=["
0a20 2f 2f 22 2c 64 2c 22 2f 67 65 6e 5f 32 30 34 3f //",d,"/ gen_204?
0a30 61 74 79 70 3d 69 26 63 74 3d 70 70 5f 74 6f 73 atyp=i&c t=pp_tos
0a40 26 63 64 3d 22 2c 62 2c 22 26 73 6f 75 72 63 65 &cd=",b, "&source
0a50 3d 22 2c 22 77 65 62 22 2c 22 26 65 69 3d 22 2c =","web" ,"&ei=",
0a60 61 2c 63 5d 2e 6a 6f 69 6e 28 22 22 29 3b 77 69 a,c].joi n("");wi
0a70 6e 64 6f 77 2e 70 70 5f 74 6f 73 2e 62 65 61 63 ndow.pp_ tos.beac
0a80 6f 6e 3d 6c 7d 66 75 6e 63 74 69 6f 6e 20 67 28 on=l}fun ction g(
0a90 62 29 7b 76 61 72 20 63 3d 6e 65 77 20 44 61 74 b){var c =new Dat
0aa0 65 28 28 6e 65 77 20 44 61 74 65 29 2e 67 65 74 e((new D ate).get
0ab0 54 69 6d 65 28 29 2b 35 31 38 34 30 30 30 30 30 Time()+5 18400000
0ac0 30 29 3b 0a 74 72 79 7b 76 61 72 20 6c 3d 22 50 0);.try{ var l="P
0ad0 50 5f 54 4f 53 5f 41 43 4b 3d 22 2b 62 2b 22 3b P_TOS_AC K="+b+";
0ae0 20 65 78 70 69 72 65 73 3d 22 2b 63 2e 74 6f 47 expires ="+c.toG
0af0 4d 54 53 74 72 69 6e 67 28 29 2b 22 3b 20 70 61 MTString ()+"; pa
0b00 74 68 3d 2f 3b 20 64 6f 6d 61 69 6e 3d 22 2b 64 th=/; do main="+d
0b10 3b 64 6f 63 75 6d 65 6e 74 2e 63 6f 6f 6b 69 65 ;documen t.cookie
0b20 3d 6c 7d 63 61 74 63 68 28 6e 29 7b 65 28 22 65 =l}catch (n){e("e
0b30 72 72 6f 72 22 2c 22 77 72 69 74 65 5f 63 6f 6f rror","w rite_coo
0b40 6b 69 65 22 29 7d 7d 66 75 6e 63 74 69 6f 6e 20 kie")}}f unction
0b50 6b 28 29 7b 67 28 2d 31 29 3b 65 28 k(){g(-1 );e(
Has anyone got any ideas as to what I might be doing wrong?