Strange firefox bug triggers on reload - http

I noticed a bug in an old version of firefox, that was shipped with my os.
These were the sympthoms:
Guile web server failed to serve the request when data was reposted.
I came up with a minimal example to show the problem.
Steps to reproduce:
start the server script
load localhost:8080
select the test.csv file for upload, and upload it
hit the refresh button in the browser
answer yes to resend post data dialog.
test.scm:
(use-modules (web server)
(rnrs bytevectors))
(define (handler request body)
(if body
(display (utf8->string body)))
(values '((content-type . (text/html)))
(string-append "<html><body>"
"<form action=\"do\" method=\"POST\" enctype=\"multipart/form-dat\
a\">"
"<input type=\"file\" name=\"x\">"
"<input type=\"submit\">")))
(run-server handler)
test.csv:
a,b
Expected result: no error displayed on the console.
Actual result:
-----------------------------18912432064747206221264673165
Content-Disposition: form-data; name="x"; filename="test.csv"
Content-Type: text/csv
In ice-9/boot-9.scm:
841:4 4 (with-throw-handler _ _ _)
In web/server/http.scm:
127:28 3 (_)
In web/request.scm:
205:31 2 (read-request #<closed: file 5559bbcb82a0> _)
In web/http.scm:
1141:6 1 (read-request-line _)
In ice-9/boot-9.scm:
752:25 0 (dispatch-exception _ _ _)
Bad request: Bad Request-Line: "a,b"
What am I doing wrong here?
Some additional information:
on a whireshark capture it turns out, that the following is sent on resend:
POST /do HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: hu-HU,hu;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: http://localhost:8080/do
Content-Type: multipart/form-data; boundary=---------------------------121791188820701943592108452984
Content-Length: 150
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Cache-Control: max-age=0
-----------------------------121791188820701943592108452984
Content-Disposition: form-data; name="x"; filename="test.csv"
Content-Type: text/csv
POST /do HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: hu-HU,hu;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: http://localhost:8080/do
Content-Type: multipart/form-data; boundary=---------------------------121791188820701943592108452984
Content-Length: 150
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Cache-Control: max-age=0
-----------------------------121791188820701943592108452984
Content-Disposition: form-data; name="x"; filename="test.csv"
Content-Type: text/csv
a,b
-----------------------------121791188820701943592108452984--
I will check the http spec if it has anything to say about this. The first http request is partial, followed by a well formed request.
UPDATE:
It turned out that guile webserver threw the error completely legitimately.

Answering my own question:
This is actually this firfox bug:
https://bugzilla.mozilla.org/show_bug.cgi?id=1434553
Fixed in firefox62.

Related

How to generate Python XHR Request in requests.post()

I am trying to get info from a website using AJAX. The Website showing different size for perfume and basically, the price would change when selecting different size.
I checked chrome Network Tab and found it's a XHR request, but looking at the request head I have no idea how to generate the same headers and data with the Requests package.
This is how my code currently looks like:
import requests
url = "https://www.beautyfresh.com/uc_aac"
session = requests.Session()
data = {"attributes[Size]":"100ml"} # I want to get the price for 100ml
headers = {"Referer": "https://www.beautyfresh.com/product/fragrance/men/perfume-fragrance/women/perfume-men/fragrance/perfume/jo-malone-orange-blossom-cologne",}
r = session.post(url,headers=headers,data=data)
print(r.text)
The General information under Chrome Network tab is
Request URL: https://www.beautyfresh.com/uc_aac
Request Method: POST
Status Code: 200 OK
Remote Address: 103.255.250.100:443
Referrer Policy: no-referrer-when-downgrade
The Response Headers is
HTTP/1.1 200 OK
date: Fri, 18 Dec 2020 02:01:05 GMT
expires: Sun, 19 Nov 1978 05:00:00 GMT
x-site: beautyfresh
x-url: /uc_aac
last-modified: Fri, 18 Dec 2020 02:01:05 GMT
x-backend-server: web4
content-type: application/json
x-varnish: 700512226
age: 0
via: 1.1 varnish (Varnish/6.0)
x-cache: MISS
cache-control: Cache-Control: store, no-cache, must-revalidate
accept-ranges: bytes
content-length: 2193
The Request Headers is
POST /uc_aac HTTP/1.1
Host: www.beautyfresh.com
Connection: keep-alive
Content-Length: 164
Accept: application/json, text/javascript, */*; q=0.01
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36
Content-Type: application/x-www-form-urlencoded
Origin: https://www.beautyfresh.com
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: https://www.beautyfresh.com/product/fragrance/men/perfume-fragrance/women/perfume-men/fragrance/perfume/jo-malone-orange-blossom-cologne
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9
Cookie: has_js=1; SESSc5f2026dce40de323b60d32130e6ce0b=n7tr5e2fsragf1js6garc6u06n; _ga=GA1.2.959938064.1608216963; _gid=GA1.2.1979056032.1608216963; _v1EmaticSolutionsUTMData=%7B%22utm_source%22%3A%22%22%2C%22utm_medium%22%3A%22%22%2C%22utm_campaign%22%3A%22%22%7D; _fbp=fb.1.1608216963288.1600789170; _v1EmaticSolutionsBye=%7B%2228732%22%3A%7B%2230038%22%3A%7B%22dont_show_till%22%3A%222020-12-20%22%2C%22loop%22%3A1%7D%7D%2C%2228739%22%3A%7B%2230045%22%3A%7B%22dont_show_till%22%3A%222020-12-20%22%2C%22loop%22%3A1%7D%7D%7D; _v1EmaticSolutionsEI=%7B%22c_28739_1%22%3A%5B1%2C1608216997180%2C33181%5D%2C%22c_28732_2%22%3A%5B1%2C1608216969616%2C0%5D%7D; _v1EmaticSolutions=%5B%22fc5d18b3-4077-11eb-970e-0242ac160003%22%2C1608217230870%2C%5B%22IMG%22%2C%22%22%2C1%2C%22glasshouse_fragrances_amalfi_coast_sea_candle_350gr.jpg%22%5D%5D; __atuvc=8%7C51; __atuvs=5fdc0d5961186ea4000; _gat=1; _dc_gtm_UA-63339192-1=1
And Form Data shows:
attributes%5BSize%5D=100ml&nid=2905&qty=1&form_build_id=form-991e88780c30fdf883375a36a986b550&form_id=uc_product_add_to_cart_form_2905&product-nid=2905&aac_nid=2905
I don't actually know how to construct my request so it can be successfully posted to the server the get the proper response. It should return the price for "100ml", but currently my code get nothing.
Thank you so much for any help!
You are missing some information in your data. To receive a response, try adding "aac_nid": "2905" to your data when sending the post request:
import requests
headers = {
"Referer": "https://www.beautyfresh.com/product/fragrance/men/perfume-fragrance/women/perfume-men/fragrance/perfume/jo-malone-orange-blossom-cologne",
}
data = {"attributes[Size]": "30ml", "aac_nid": "2905"}
response = requests.post(
"https://www.beautyfresh.com/uc_aac", headers=headers, data=data
)
>>> print(response.content)
b'{"nid":"2905","model":"690251006564","replacements":{"sellprice":"<div class=\\"product-info sellprice\\"><div class=\'retail_price\'>City Price: <div class=\'product-info retail_price\'><span class=\'uc-price\'>S$110.00<\\/span><\\/div><\\/div>\\r\\n <div class=\'promoprice\'>Our Price: <div class=\'product-info sellprice1\'><span class=\'uc-price\'>S$89.00<\\/span><\\/div><\\/div><\\/div>","model":"<div class=\\"model\\"><span class=\\"label\\">Product Code: <\\/span>690251006564<\\/div>"},"form":"<form action=\\"\\/uc_aac\\" accept-charset=\\"UTF-8\\" method=\\"post\\" id=\\"uc-product-add-to-cart-form\\" class=\\" uc-aac-cart\\">\\n<div><div class=\'attributes\'><div class=\\"form-item\\" id=\\"edit-attributes-Size-wrapper\\">\\n <label for=\\"edit-attributes-Size\\">Size <span class=\\"form-required\\" title=\\"This field is required.\\">*<\\/span><\\/label>\\n <select name=\\"attributes[Size]\\" class=\\"form-select required chosen-widget\\" data-name=\\"Size\\" id=\\"edit-attributes-Size\\" ><option value=\\"30ml\\" selected=\\"selected\\">30ml<\\/option><option value=\\"100ml\\">100ml<\\/option><\\/select>\\n<\\/div>\\n<\\/div><input type=\\"hidden\\" name=\\"nid\\" id=\\"edit-nid\\" value=\\"2905\\" \\/>\\n<div class=\\"form-item\\" id=\\"edit-qty-wrapper\\">\\n <label for=\\"edit-qty\\">Qty <\\/label>\\n <input type=\\"text\\" maxlength=\\"3\\" name=\\"qty\\" id=\\"edit-qty\\" size=\\"5\\" value=\\"1\\" class=\\"form-text textfield\\" \\/>\\n<\\/div>\\n<input type=\\"hidden\\" name=\\"form_build_id\\" id=\\"form-b7adf002178f04ed96377894057352a2\\" value=\\"form-b7adf002178f04ed96377894057352a2\\" \\/>\\n<input type=\\"hidden\\" name=\\"form_id\\" id=\\"edit-uc-product-add-to-cart-form\\" value=\\"uc_product_add_to_cart_form\\" \\/>\\n<input type=\\"hidden\\" name=\\"aac_nid\\" id=\\"edit-aac-nid\\" value=\\"2905\\" \\/>\\n<div class=\'leadtime_message\' style=\'margin-bottom:1em;\'><p>Delivers in 1-3 working days<\\/p><\\/div><input type=\\"submit\\" name=\\"op\\" id=\\"edit-submit-2905\\" value=\\"Add to Cart\\" class=\\"notranslate form-submit node-add-to-cart primary\\" \\/>\\n\\n<\\/div><\\/form>\\n"}'
To get the price, try searching for it with the help of the built-in re (regex) module:
import re
prices = re.findall(r"'uc-price\\'>S(\$\d.*?)<", str(response.content))
print("Original Price:", prices[0])
print("Our Price:", prices[1])
Output:
Original Price: $110.00
Our Price: $89.00

What is wrong with my GET request?

Sorry to bother with something that should be easy.
I have this HTTP GET request:
GET /ip HTTP/1.1
Host: httpbin.org
Connection: close
Accept: */*
User-Agent: Mozilla/4.0 (compatible; esp8266 Lua; Windows NT 5.1)
When I send this request via my ESP8266 it returns a 404 error:
HTTP/1.1 404 Not Found
Date: Fri, 04 Sep 2015 16:34:46 GMT
Server: Apache
Content-Length: 1363
X-Frame-Options: deny
Connection: close
Content-Type: text/html
But when I (and you) go to http://httpbin.org/ip it works perfectly!
What is wrong?
DETAILS
I construct my request in Lua:
conn:on("connection", function(conn, payload)
print('\nConnected')
req = "GET /ip"
.." HTTP/1.1\r\n"
.."Host: httpbin.org\r\n"
.."Connection: close\r\n"
.."Accept: */*\r\n"
.."User-Agent: Mozilla/4.0 (compatible; esp8266 Lua; Windows NT 5.1)\r\n"
.."\r\n"
print(req)
conn:send(req)
end)
And if I use another host (given is this example) it works:
conn:on("connection", function(conn, payload)
print('\nConnected')
conn:send("GET /esp8266/test.php?"
.."T="..(tmr.now()-Tstart)
.."&heap="..node.heap()
.." HTTP/1.1\r\n"
.."Host: benlo.com\r\n"
.."Connection: close\r\n"
.."Accept: */*\r\n"
.."User-Agent: Mozilla/4.0 (compatible; esp8266 Lua; Windows NT 5.1)\r\n"
.."\r\n")
end)
Are you actually connecting to httpbin.org ? Or somewhere else?
I just tried issuing your request by typing it into telnet, and it worked for me. But the server responding was nginx, whereas your example shows apache.
$ telnet httpbin.org 80
Trying 54.175.219.8...
Connected to httpbin.org.
Escape character is '^]'.
GET /ip HTTP/1.1
Host: httpbin.org
Connection: close
Accept: */*
User-Agent: Mozilla/4.0 (compatible; esp8266 Lua; Windows NT 5.1)
HTTP/1.1 200 OK
Server: nginx
Date: Wed, 07 Oct 2015 06:08:40 GMT
Content-Type: application/json
Content-Length: 32
Connection: close
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
{
"origin": "124.149.55.34"
}
Connection closed by foreign host.
When I try another request with some other URI to force a 404 response, I see this:
HTTP/1.1 404 NOT FOUND
Server: nginx
Date: Wed, 07 Oct 2015 06:12:21 GMT
Content-Type: text/html
Content-Length: 233
Connection: close
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
Which again is nothing like the response you said you got from httpbin.org.
http.get("http://httpbin.org/ip", nil, function(code, data)
if (code < 0) then
print("HTTP request failed")
else
print(code, data)
end
end)
http.post('http://httpbin.org/post',
'Content-Type: application/json\r\n',
'{"hello":"world"}',
function(code, data)
if (code < 0) then
print("HTTP request failed")
else
print(code, data)
end
end)
see the reference here.
It's your request line the server doesn't like.
This will do the job:
GET http://httpbin.org/ip HTTP/1.1
Host: httpbin.org

Jquery XML POST not properly setting the request

I have a rest service and I'm trying to call it through jquery client. The backend rest service works find when I send a response like below through CURL.
curl -H "Accept: text/plain" -X POST -d 'host=<type:hostDescription xmlns:type="http://schemas.airavata.apache.org/gfac/type"><type:hostName>testHost5</type:hostName><type:hostAddress>aaaa</type:hostAddress></type:hostDescription>' http://localhost:6060/airavata-registry-rest-services/registry/api/hostdescriptor/save
This request looks like following.
POST /airavata-registry-rest-services/registry/api/hostdescriptor/save HTTP/1.1
User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
Host: 127.0.0.1
Accept: text/plain
Content-Length: 189
Content-Type: application/x-www-form-urlencoded
host=<type:hostDescription xmlns:type="http://schemas.airavata.apache.org/gfac/type">
<type:hostName>testHost5</type:hostName>
<type:hostAddress>aaaa</type:hostAddress></type:hostDescription>
But the issue is that the request sent by my jquery client looks like below.
POST /airavata-registry-rest-services/registry/api/hostdescriptor/save HTTP/1.1
Host: 127.0.0.1
Connection: keep-alive
Content-Length: 276
Origin: http://localhost:7080
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.11 (KHTML, like Gecko) Ubuntu/12.04 Chromium/20.0.1132.47 Chrome/20.0.1132.47 Safari/536.11
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Accept: */*
Referer: http://localhost:7080/client-api-demo/x_host_descriptor_save.html
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
host=%3Ctype%3Ahostdescription+xmlns%3Atype%3D%22http%3A%2F%2Fschemas.airavata.apache.org%2Fgfac%2Ftype%22%3E%3Ctype%3Ahostname%3Eutav%3C%2Ftype%3Ahostname%3E%3Ctype%3Ahostaddress%3Egatekeeper2.ranger.tacc.teragrid.org%3C%2Ftype%3Ahostaddress%3E%3C%2Ftype%3Ahostdescription%3E
My jquery code snippet looks like following;
$('[name="btn2"]').click(function(){
var hostName = $("#hostName1").val();
var hostAddress = $("#hostAddress1").val();
var xml = $('<type:hostDescription xmlns:type="http://schemas.airavata.apache.org/gfac/type"><type:hostName>' + hostName + '</type:hostName><type:hostAddress>' + hostAddress + '</type:hostAddress></type:hostDescription>');
var xmlData= $(xml);
var xmlString;
if (window.ActiveXObject){
xmlString = xmlData.xml;
} else {
var oSerializer = new XMLSerializer();
xmlString = oSerializer.serializeToString(xmlData[0]);
}
console.log(xmlString);
$.post("http://localhost:6060/airavata-registry-rest-services/registry/api/hostdescriptor/save",
{ host: xmlString} ,function(data,status){
alert("Data: " + data + "\nStatus: " + status);
alert("button2 post sent !");
});
});
How should I change my client to invoke this service properly.

Method Not Implemented Error Jboss4 - Unsupported for "multipart/form-data"

I have been unable to get a solution from within SO hence posting.
I have a sample JSP page that is posting to a vendor product that implements and image upload facility.
<script type="text/javascript">
function upload(){
document.forms[0].enctype="multipart/form-data"
document.forms[0].action="/upload"
document.forms[0].submit()
}
</script>
After posting the form while monitoring the request I am getting the following response and the servlet is defaulting to processing the input with content type = "application/x-www-form-urlencoded"
These are the request headers:
POST /upload HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Referer: http://localhost:9001/ansHealthConsole/htmljsp/common/reattach_file.jsp?JOBNAME=RESCAN_IMAGES&RFCNAME=READ&SEQNUM=100041767&SESSIONID=62767&SECURETXNID=7309450930646918658&
Accept-Language: en-us
Content-Type: multipart/form-data; boundary=---------------------------7dc3c0d25050c
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.3; .NET4.0C; .NET4.0E)
Host: localhost:9001
Content-Length: 71671
Connection: Keep-Alive
Cache-Control: no-cache
The response headers are as follows:
HTTP/1.1 501 Not Implemented
X-Powered-By: Servlet 2.4; Tomcat-5.0.28/JBoss-4.0.1 (build: CVSTag=JBoss_4_0_1 date=200412230944)
Content-Type: text/html;charset=utf-8
Content-Length: 989
Date: Fri, 07 Sep 2012 06:13:34 GMT
Server: Apache-Coyote/1.1
Connection: close
I am unable to debug whether the "multipart/--" is not supported within the Tomcat of Jboss 4 or I have some other error.

What is the invalid request header name here?

GET http://msdn.microsoft.com/en-us/library/ms737550(v=vs.85).aspx HTTP/1.1
Host: msdn.microsoft.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; zh-CN; rv:1.9.2.17) Gecko/20110420 AlexaToolbar/alxf-2.11 Firefox/3.6.17
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-cn,zh;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: GB2312,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Proxy-Connection: keep-alive
Cookie: A=I&I=AxUFAAAAAAA6BwAAF8HSyidJIZx1KvyAM/QBJw!!&M=1&CS=1175b0002j2020#; TocHashCookie=ms310241(n)/aa139672(n)/ff576017(VS.85,n)/ff576020(VS.85,n)/ff576022(VS.85,n)/ff573209(VS.85,n)/ff573212(VS.85,n)/ff573407(VS.85,n)/ff573625(VS.85,n)/ff573631(VS.85,n)/na/; omniID=1304990477297_007d_a5e4_4a8f_b3cc040ef8ae; WT_FPC=id=116.236.150.80-235145280.30150320:lv=1305713955000:ss=1305712394162; WT_NVR_RU=0=msdn:1=:2=; WT_NVR=0=/:1=en-us:2=en-us/library|zh-cn/library; msresearch=%7B%22version%22%3A%224.6%22%2C%22state%22%3A%7B%22name%22%3A%22IDLE%22%2C%22url%22%3Aundefined%2C%22timestamp%22%3A1304990488606%7D%2C%22lastinvited%22%3A1304990488606%2C%22userid%22%3A%2213049904886068387915347343170%22%2C%22vendorid%22%3A1%2C%22surveys%22%3A%5Bundefined%5D%7D; MC1=GUID=fb6fc2d32e7a924698e043e5f5aff4e6&HASH=d3c2&LV=20115&V=3; msdn=L=2052; mcI=Tue, 24 May 2011 05:51:59 GMT; MUID=0DBD349328166C4B30BF35662D166C8B; MSID=Microsoft.CreationDate=05/17/2011 05:48:18&Microsoft.LastVisitDate=05/18/2011 02:00:06&Microsoft.VisitSt
artDate=05/18/2011 02:00:06&Microsoft.CookieId=979bc6e3-fa2d-4dad-816c-432790d7397e&Microsoft.TokenId=ffffffff-ffff-ffff-ffff-ffffffffffff&Microsoft.NumberOfVisits=5&Microsoft.CookieFirstVisit=1&Microsoft.IdentityToken=AA==&Microsoft.MicrosoftId=0359-2958-1412-9584; TocPosition=0; s_sq=%5B%5BB%5D%5D; s_cc=true; ADS=SN=175A21EF; GsfxSessionCookie=144229042098420446; GsfxStatsLog=true
Cache-Control: max-age=0
The above is dumped from my programe,but I don't see which part is invalid...
The line after Cookie is invalid as it needs to be indented to be interpreted as a fold:
HTTP/1.1 header field values can be folded onto multiple lines if the
continuation line begins with a space or horizontal tab. All linear
white space, including folding, has the same semantics as SP. A
recipient MAY replace any linear white space with a single SP before
interpreting the field value or forwarding the message downstream.
LWS = [CRLF] 1*( SP | HT )
Thus:
Cookie: A=I&I=AxUFAAAAAAA6BwAAF8HSyidJIZx1KvyAM/QBJw!!&M=1&CS=1175b0002j2020#; TocHashCookie=ms310241(n)/aa139672(n)/ff576017(VS.85,n)/ff576020(VS.85,n)/ff576022(VS.85,n)/ff573209(VS.85,n)/ff573212(VS.85,n)/ff573407(VS.85,n)/ff573625(VS.85,n)/ff573631(VS.85,n)/na/; omniID=1304990477297_007d_a5e4_4a8f_b3cc040ef8ae; WT_FPC=id=116.236.150.80-235145280.30150320:lv=1305713955000:ss=1305712394162; WT_NVR_RU=0=msdn:1=:2=; WT_NVR=0=/:1=en-us:2=en-us/library|zh-cn/library; msresearch=%7B%22version%22%3A%224.6%22%2C%22state%22%3A%7B%22name%22%3A%22IDLE%22%2C%22url%22%3Aundefined%2C%22timestamp%22%3A1304990488606%7D%2C%22lastinvited%22%3A1304990488606%2C%22userid%22%3A%2213049904886068387915347343170%22%2C%22vendorid%22%3A1%2C%22surveys%22%3A%5Bundefined%5D%7D; MC1=GUID=fb6fc2d32e7a924698e043e5f5aff4e6&HASH=d3c2&LV=20115&V=3; msdn=L=2052; mcI=Tue, 24 May 2011 05:51:59 GMT; MUID=0DBD349328166C4B30BF35662D166C8B; MSID=Microsoft.CreationDate=05/17/2011 05:48:18&Microsoft.LastVisitDate=05/18/2011 02:00:06&Microsoft.VisitSt
artDate=05/18/2011 02:00:06&Microsoft.CookieId=979bc6e3-fa2d-4dad-816c-432790d7397e&Microsoft.TokenId=ffffffff-ffff-ffff-ffff-ffffffffffff&Microsoft.NumberOfVisits=5&Microsoft.CookieFirstVisit=1&Microsoft.IdentityToken=AA==&Microsoft.MicrosoftId=0359-2958-1412-9584; TocPosition=0; s_sq=%5B%5BB%5D%5D; s_cc=true; ADS=SN=175A21EF; GsfxSessionCookie=144229042098420446; GsfxStatsLog=true
But as a folding is interpreted as a single space, you should fold the line at a separator that allows a space without adulterating the value like after a ;:
Cookie: A=I&I=AxUFAAAAAAA6BwAAF8HSyidJIZx1KvyAM/QBJw!!&M=1&CS=1175b0002j2020#; TocHashCookie=ms310241(n)/aa139672(n)/ff576017(VS.85,n)/ff576020(VS.85,n)/ff576022(VS.85,n)/ff573209(VS.85,n)/ff573212(VS.85,n)/ff573407(VS.85,n)/ff573625(VS.85,n)/ff573631(VS.85,n)/na/; omniID=1304990477297_007d_a5e4_4a8f_b3cc040ef8ae; WT_FPC=id=116.236.150.80-235145280.30150320:lv=1305713955000:ss=1305712394162; WT_NVR_RU=0=msdn:1=:2=; WT_NVR=0=/:1=en-us:2=en-us/library|zh-cn/library; msresearch=%7B%22version%22%3A%224.6%22%2C%22state%22%3A%7B%22name%22%3A%22IDLE%22%2C%22url%22%3Aundefined%2C%22timestamp%22%3A1304990488606%7D%2C%22lastinvited%22%3A1304990488606%2C%22userid%22%3A%2213049904886068387915347343170%22%2C%22vendorid%22%3A1%2C%22surveys%22%3A%5Bundefined%5D%7D; MC1=GUID=fb6fc2d32e7a924698e043e5f5aff4e6&HASH=d3c2&LV=20115&V=3; msdn=L=2052; mcI=Tue, 24 May 2011 05:51:59 GMT;
MUID=0DBD349328166C4B30BF35662D166C8B; MSID=Microsoft.CreationDate=05/17/2011 05:48:18&Microsoft.LastVisitDate=05/18/2011 02:00:06&Microsoft.VisitStartDate=05/18/2011 02:00:06&Microsoft.CookieId=979bc6e3-fa2d-4dad-816c-432790d7397e&Microsoft.TokenId=ffffffff-ffff-ffff-ffff-ffffffffffff&Microsoft.NumberOfVisits=5&Microsoft.CookieFirstVisit=1&Microsoft.IdentityToken=AA==&Microsoft.MicrosoftId=0359-2958-1412-9584; TocPosition=0; s_sq=%5B%5BB%5D%5D; s_cc=true; ADS=SN=175A21EF; GsfxSessionCookie=144229042098420446; GsfxStatsLog=true

Resources