タグ

2018年1月12日のブックマーク (3件)

  • Transfer-Encoding: chunked について - 理系学生日記

    Tomcat をコンテナとした Servlet のコード上で Content-Length ヘッダを設定していたのですが、なぜか HTTP レスポンスのヘッダには Content-Length が出力されないという事象が確認されました。 これは一体なぜなのだろうと調べていると、当該レスポンスのヘッダに Transfer-Encoding: Chunked が出力されていることに気付きました。 Chunked は HTTP/1.1 で定義されている方式です。RFC 2068 には以下のような記述があり、Chunked と Content-Length を共存させてはいけない (MUST NOT) ことが分かります。) Messages MUST NOT include both a Content-Length header field and the "chunked" transfer

    Transfer-Encoding: chunked について - 理系学生日記
  • Starting Out - Learn You a Haskell for Great Good!

    Starting Out Ready, set, go! Alright, let's get started! If you're the sort of horrible person who doesn't read introductions to things and you skipped it, you might want to read the last section in the introduction anyway because it explains what you need to follow this tutorial and how we're going to load functions. The first thing we're going to do is run ghc's interactive mode and call some fu

  • TCPを使う(サーバ、SO_REUSEADDR):Geekなぺーじ

    前述したTCPサーバ例では、サーバを終了した直後にもう一度サーバを起動しようとすると、bindがエラーで終了することがあります。 ここでは、その問題を回避するためにSO_REUSEADDRを有効にする方法を説明したいと思います。 TIME_WAIT TCPサーバのプログラムを書いていて、TCPサーバを終了して直後にもう一度起動したときに、 bindが「Address already in use」というようなエラーで失敗してしまったとこは無いでしょうか? 「あれ?もうTCPのサーバプロセスは終了しているのに。何故、bind出来ないのだろう?」と思いつつ、 しばらく時間がたってからもう一度実行すると問題なくbindが成功したりします。 この問題はTCP自体の仕組み(仕様)によって引き起こされています。(winsockの問題ではなく、TCPの仕様です)。 具体的にはTIME_WAIT状態という