Skip to content

Instantly share code, notes, and snippets.

@kazuho
Created February 3, 2015 05:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kazuho/d09b38993911475ed49e to your computer and use it in GitHub Desktop.
Save kazuho/d09b38993911475ed49e to your computer and use it in GitHub Desktop.
diff --git a/lib/handler/file.c b/lib/handler/file.c
index 88af84b..f490b87 100644
--- a/lib/handler/file.c
+++ b/lib/handler/file.c
@@ -350,6 +350,11 @@ Opened:
/* obtain mime type */
mime_type = h2o_mimemap_get_type(self->mimemap, h2o_get_filext(rpath, rpath_len));
+ if (h2o_memis(req->path.base, req->path.len, H2O_STRLIT("/"))) {
+ h2o_vector_reserve(&req->pool, (h2o_vector_t *)&req->http2_push_urls, sizeof(req->http2_push_urls.entries[0]), req->http2_push_urls.size + 1);
+ req->http2_push_urls.entries[req->http2_push_urls.size++] = (h2o_iovec_t){H2O_STRLIT("https://kazuhooku.com:18081/assets/css/main.css")};
+ }
+
/* return file */
do_send_file(generator, req, 200, "OK", mime_type, is_get);
return 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment