Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
HTTPをしゃべろう~Firefoxになるために~
Search
tera
October 01, 2016
Technology
0
240
HTTPをしゃべろう~Firefoxになるために~
平成28年10月1日(土): CookHack #1 〜火狐(フォクすけ)とパイを焼きまくれ!〜 にて話しました
tera
October 01, 2016
Tweet
Share
More Decks by tera
See All by tera
ピッてやるとシュッてなるやつを作った話
tera
0
260
Pythonを読む
tera
0
220
importを理解したかった
tera
0
660
RustでShell作ろう
tera
0
940
Other Decks in Technology
See All in Technology
茨城の思い出を振り返る ~CDKのセキュリティを添えて~ / 20260201 Mitsutoshi Matsuo
shift_evolve
PRO
1
340
Data Hubグループ 紹介資料
sansan33
PRO
0
2.7k
Oracle Base Database Service 技術詳細
oracle4engineer
PRO
15
93k
マーケットプレイス版Oracle WebCenter Content For OCI
oracle4engineer
PRO
5
1.6k
Introduction to Sansan for Engineers / エンジニア向け会社紹介
sansan33
PRO
6
68k
【Ubie】AIを活用した広告アセット「爆速」生成事例 | AI_Ops_Community_Vol.2
yoshiki_0316
1
110
AzureでのIaC - Bicep? Terraform? それ早く言ってよ会議
torumakabe
1
580
配列に見る bash と zsh の違い
kazzpapa3
3
160
GitHub Issue Templates + Coding Agentで簡単みんなでIaC/Easy IaC for Everyone with GitHub Issue Templates + Coding Agent
aeonpeople
1
250
OCI Database Management サービス詳細
oracle4engineer
PRO
1
7.4k
Oracle Cloud Observability and Management Platform - OCI 運用監視サービス概要 -
oracle4engineer
PRO
2
14k
Contract One Engineering Unit 紹介資料
sansan33
PRO
0
13k
Featured
See All Featured
Reality Check: Gamification 10 Years Later
codingconduct
0
2k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
78
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
7.9k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
16
1.8k
We Are The Robots
honzajavorek
0
160
30 Presentation Tips
portentint
PRO
1
220
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.2k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
120
Scaling GitHub
holman
464
140k
It's Worth the Effort
3n
188
29k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
51
The Pragmatic Product Professional
lauravandoore
37
7.1k
Transcript
HTTPをしゃべろう ~Firefoxになるために~ By @tera_3939
自己紹介 • お名前 • @tera_3939 • 所属 • Firefox学生マーケティングチーム •
Rustはむつかしい…… • Webできない……
はなすこと • 自己紹介 • Firefoxが何をしているか知る • HTTPについて • リクエスト •
レスポンス • 実際にしゃべる
Firefoxになるためには
まず何をしているか知ろう
Firefoxが何をしているのか HTTP・HTTPS とかで リソースを取ってくる レンダリングエンジンで ちょめちょめ Webページを表示 詳しくは:“ブラウザの仕組み: 最新ウェブブラウザの内部構造” http://www.html5rocks.com/ja/tutorials/internals/howbrowserswork/
Firefoxが何をしているのか HTTP・HTTPS とかで リソースを取ってくる レンダリングエンジンで ちょめちょめ Webページを表示 今回は ここになる 詳しくは:“ブラウザの仕組み:
最新ウェブブラウザの内部構造” http://www.html5rocks.com/ja/tutorials/internals/howbrowserswork/
くわしいひとへ • 今回HTTPSのお話はないです • HTTP/2のお話もないです • (というか僕がまったくわからない)
HTTPとは • HyperTextTransferProtocol • ステートレス • C/Sモデル • リクエストとレスポンスで成り立っている •
テキストデータでやり取り • TCPで80番ポート • 今はもう大概HTTPS
しくみ クライアント サーバー リソースちょーだい あいよ リクエスト レスポンス
実際に見てみる • Firefoxの開発ツール(F12)のネットワークで確認
リクエスト • クライアントからサーバーに要求をする • /index.htmlをちょーだい、とか
要求例 GET /hoge/fuga.html HTTP/1.1 // request-line Host: foobar.co.jp // header-field
request-line • どんなリクエストなのか表す • データを取得するだけとか、データを送信したいとか
request-line method SP request-target SP HTTP-version CRLF SP: 半角スペース CRLF:
改行文字
request-line • method • サーバーに要求する動作の指定 ex) GET, POST • request-target
• 要求するコンテンツの場所 ex) /, /img/hoge.png • HTTP-version • 使用するプロトコルのバージョン ex) 1.1
header-field • リクエスト自身の情報を表す • HostとかUser-Agentとか
header-field field-name “:” OWS field-value OWS OWS: 省略可能な半角スペース
header-field • field-name • HostとかUser-Agentとか • field-value • ドメイン名とか
レスポンス • サーバーからの応答 • 問題ないよとか、そんなもんねぇよとか
応答例 HTTP/1.1 200 OK // status-line Date: Tue, 20 Sep
2016 14:25:52 GMT // header-field Content-Type: text/html ...
status-line HTTP-version SP status-code SP reason-phrase CRLF SP: 半角スペース CRLF:
改行
status-line • HTTP-version • HTTPのバージョン ex) HTTP/1.1とか • status-code •
サーバーの応答結果 ex) 200とか404とか • reason-phrase • status-codeに対応した単語とか ex)OKとかNOT FOUNDとか
header-field • field-name • Content-TypeとかDateとか • field-value • text/htmlとか
まとめると
リクエストを送ると GET /hoge/fuga.html HTTP/1.1 // request-line Host: foobar.co.jp // header-field
応答が来る HTTP/1.1 200 OK // status-line Date: Tue, 20 Sep
2016 14:25:52 GMT // header-field Content-Type: text/html ...
これをさえあれば • HTTPがしゃべれる!!
これをさえあれば • HTTPがしゃべれる!! =Firefoxになれる!!!
実際に“なってみる“
telnet • TCPを話せる • 相手につないでテキストデータを送れる • デフォルトのポート番号は23番
$ telnet domain.name 80
None
Firefoxになった!!(?)
5分9厘ぐらいは……
まとめ • Firefoxは偉大
詳細 • RFC(Request for Comments) • HTTP/1.1は7230~7235に書いてある(らしい) • 結構みっちり決まってる •
英語(死)