2017-03-14 11 views
-2

猫のmain.goで、他のHTTPリクエストによって改ざんされています。HTTP要求はgolangと標準ライブラリ

ように、クライアントのクエリ/users/1234567/places/users/1234567、と...

は、応答が{blank data}{normal user(1234567) data}または{normal user(1234567) data}{normal user(1234567) data}で取得します。

同じプレフィックスのクエリと同じハンドラは、後続のHTTP要求による応答のオーバーロードのようです。

どうすればいいですか?

{ "meta": { "code": 200, "text": "OK" }, "data": { "count": 21, "place-tag-maps": [{ "id": "95842310160384", "place-id": "95551731663150", "tag-id": "95551579750669", "ct": "2014-07-01T09:07:28Z" }, { "id": "95842310160385", "place-id": "95551731663150", "tag-id": "95551579750694", "ct": "2015-01-15T17:41:23Z" }, { "id": "96262389694470", "place-id": "95551731663150", "tag-id": "95910120456455", "ct": "2016-07-18T13:11:39Z" }, ...], "places": [{ "id": "95551731663150", "name": "Kam Fung Restaurant", "address": "G/F, 41 Spring Garden Ln", "coordinate": { "latitude": 22.275576, "longitude": 114.172582 }, "telephone": "+852 2572 0526", "city-id": "95530516807703", "city": "Hong Kong", "country": "Hong Kong", "type": "4sq", "ref-id": "4b1613f8f964a520cdb623e3", "ct": "2016-02-23T07:42:43.565489Z", "mt": "2017-02-22T09:35:48.302929Z", "rating": 7.5, "stats": { "foursquare": { "count": 111, "value": 7.5 }, "spottly": { "save-count": 12 } }, "permanent-close": false, "price": "" }, ...], "posts": [{ "collection-id": "95551746474003", "coordinate": { "latitude": 22.275576, "longitude": 114.172582 }, "ct": "2017-02-22T09:35:47Z", "facebook-tag-users": [], "id": "97501586849795", "medias": [], "message": "", "mt": "2017-02-22T09:35:47Z", "owner-id": "96527264645120", "place-id": "95551731663150", "share-to": [], "star": 5, "status": "Done", "tags": [] }, ...], "users": [{ "id": "95551581323446", "uid": "hk_epicurus", "uid-ignore-case": "hk_epicurus", "name": "Hk Epicurus", "head": "https://d278wa0j9nq2mp.cloudfront.net/uploader/54aa335ddf4e63450002919a.jpeg", "site": "www.hkepicurus.com", "location": "Hong Kong", "description": "Hong Kong Food \u0026 Travel Bear.\nGrew up in Aust, Malaysia, Tokyo \u0026 HK. \nInstagram: EpicurusHongKong\nFacebook, Spottly \u0026 Twitter: HK Epicurus \n微博: 香港美食-伊比\nFacebook Fans Page: http://on.fb.me/1qDyiIk", "ct": "2013-10-13T19:12:41Z", "mt": "2015-11-08T15:22:45Z" }, ...] } } { "meta": { "code": 200, "text": "OK" }, "data": { "friends": [{ "id": "97331335725056", "from-id": "97273770803200", "to-id": "96527264645120", "ct": "2017-01-23T07:58:41Z" }], "user": { "ct": "2013-04-30T23:30:05Z", "description": "Founder and Chief Everything Officer of Spottly. Loves to eat. Have a really bad memory. Wants to remember the best places and make travel research better", "followers": { "count": 41291 }, "followings": { "count": 322 }, "head": "https://d278wa0j9nq2mp.cloudfront.net/uploader/525ffac8df4e6347870145ef.jpeg", "id": "96527264645120", "location": "Vancouver | Hong Kong | Beijing ", "mt": "2015-10-27T09:47:12Z", "name": "Edwyn Chan", "site": "http://spottly.com/edwyn", "uid": "edwyn", "uid-ignore-case": "edwyn" } } }

が、間違い応答が

{ "meta": { "code": 200, "text": "OK" } } { "meta": { "code": 200, "text": "OK" }, "data": { "friends": [{ "id": "97331335725056", "from-id": "97273770803200", "to-id": "96527264645120", "ct": "2017-01-23T07:58:41Z" }], "user": { "ct": "2013-04-30T23:30:05Z", "description": "Founder and Chief Everything Officer of Spottly. Loves to eat. Have a really bad memory. Wants to remember the best places and make travel research better", "followers": { "count": 41291 }, "followings": { "count": 322 }, "head": "https://d278wa0j9nq2mp.cloudfront.net/uploader/525ffac8df4e6347870145ef.jpeg", "id": "96527264645120", "location": "Vancouver | Hong Kong | Beijing ", "mt": "2015-10-27T09:47:12Z", "name": "Edwyn Chan", "site": "http://spottly.com/edwyn", "uid": "edwyn", "uid-ignore-case": "edwyn" } } }

です:

正しい応答は次のとおりです。

は応答の例を与えるために私を必要とするかもしれません

最初の応答はエラーです。それは2番目の応答と同じです。

シーケンス要求は正しい応答ですが、パラレル要求は誤った応答です。

+1

あなたの問題は何かを理解することは難しいです... –

+0

@AlexanderR。私は問題をクリアするための応答の例を追加します –

+0

fcgiは90年代の遺物であり、現在はそれを使用する正当な理由はありません。この不完全な例に未知数を追加するだけです。 – JimB

答えて

0

問題は解決

基本的な理由は、この場合です:。、そう

var x = &{...} //init value 
fillX(..., x) //fill the fields of x pointer 
//here the fields of x pointer is not same to inner of fillX func 

var x = &{...} 
x = fullX(..., x) 
the problem resolved. 

への変更が、なぜポインタが動作です行きますか?

関連する問題