Upgrade to Pro — share decks privately, control downloads, hide ads and more …

リダイレクト

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
Avatar for ruuuui ruuuui
August 08, 2017
38

 リダイレクト

Avatar for ruuuui

ruuuui

August 08, 2017
Tweet

Transcript

  1. ϦμΠϨΫτઌͷυϝΠϯνΣοΫ • ๬·͍͠ॻ͖ํ if (mb_ereg('\Ahttps?://example\.jp/[-_.!~*\'();\/?:@&=+\$,$#a-zA-Z0-9]*\z', $url)) { // νΣοΫOK }

    • "http://example.jp/" ·ͨ͸ "https://example.jp/" Ͱ࢝·Δ͜ͱ • จࣈྻͷઌ಄ɾ຤ඌΛࣔ͢ه߸ͱͯ͠ "\A" ͱ "\z" Λ࢖༻ • "https?" ͸httpͱhttpsͷ྆ํʹରԠ͢Δ
  2. Ϩεϙϯεϔομ ϑΟʔϧυ໊ ಺༰ Server ΢Σϒαʔόͷ໊લͱόʔδϣϯ৘ใɻ Date ݱࡏͷ೔෇ʢάϦχοδඪ४࣌ʣ Last-Modified Ϧιʔεͷߋ৽೔ Content-Length

    ग़ྗͷόΠτ୯Ґͷ௕͞ όΠφϦσʔλ΋ؚΈ·͢ɻ Content-Type ग़ྗͷMIMEλΠϓ Expires Ϧιʔεͷ༗ޮظݶ ͜ͷ೔෇Ҏ߱͸ແޮͰ͢ɻΩϟογϡ͸ഁ Location ϦμΠϨΫτ URL ৘ใ Location Ͱࢦఆ͞ΕͨϦιʔε͕ૹ৴͞Ε· Pragma ϦιʔεͷΩϟογϯάΛ༗ޮ/ແޮʹ͢ Δ Status ϦΫΤετͷεςʔλε ୯ಠϔομͱͯ͠ग़ྗ͞Ε·͢ɻ WWW-Authenticate ೝূσʔλɻ ೝূʹඞཁͳϢʔβʔ໊΍ύεϫʔυͳͲ Refresh ࢦఆ͞ΕͨυΩϡϝϯτΛ࠶ϩʔυ͢ Δɻ Set-Cookie σʔλΛΫϥΠΞϯτଆʹอଘ͢Δɻ Etag αʔόʔݻ༗ͷ৘ใ͕෇༩͞Εɺϒϥ΢β ΩϟογϡΛ࠶ར༻͢Δ͔Ͳ͏͔൑அͤ͞
  3. HTTPϔομΠϯδΣΫγϣϯͱ͸ <?php header('Location: ' . $_GET['url']); ͜ΕʹΑΓੜ੒͞ΕΔHTTPϨεϙϯεϔομ͸ҎԼͱͳΓ·͢ɻ Location: http://example/top.php Set-Cookie:

    PHPSESSID=ABC http://example.jp/header.php?url=http://example/top.php%0d%0aSet-Cookie:+PHPSESSID%3DABC ։ൃऀͷҙਤ͠ͳ͍Ϩεϙϯε͕ग़ྗ͞ΕΔ ྫʣηογϣϯݻఆ߈ܸͳͲ