about summary refs log tree commit homepage
path: root/http_get.c
diff options
context:
space:
mode:
Diffstat (limited to 'http_get.c')
-rw-r--r--http_get.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/http_get.c b/http_get.c
index 45470e5..252ec5c 100644
--- a/http_get.c
+++ b/http_get.c
@@ -44,8 +44,9 @@ static ssize_t linux_sendfile(int sockfd, int filefd, off_t *off, size_t count)
  * so we won't hurt code maintainability by optimizing away snprintf()
  * ourselves.  This function is ugly enough already
  */
-static off_t http_get_resp_hdr(struct mog_http *http, struct stat *sb)
+static off_t http_get_resp_hdr(struct mog_fd *mfd, struct stat *sb)
 {
+        struct mog_http *http = &mfd->as.http;
         char *modified;
         void *buf;
         size_t len;
@@ -176,7 +177,7 @@ bad_range:
         if (http->_p.http_method == MOG_HTTP_METHOD_HEAD)
                 count = 0;
 
-        http->wbuf = mog_trysend(mog_fd_of(http)->fd, buf, len, (off_t)count);
+        http->wbuf = mog_trysend(mfd->fd, buf, len, (off_t)count);
 
         return (off_t)count;
 }
@@ -219,7 +220,7 @@ void mog_http_get_open(struct mog_fd *mfd, char *buf)
                 file->fsize = sb.st_size;
         }
 
-        len = http_get_resp_hdr(http, &sb);
+        len = http_get_resp_hdr(mfd, &sb);
 
         /* http->forward may be NULL even if file is set if we had an error */
         if (http->wbuf == NULL && http->forward) {
@@ -233,14 +234,14 @@ err:
         switch (errno) {
         case EACCES:
 forbidden:
-                mog_http_resp(http, "403 Forbidden", true);
+                mog_http_resp(mfd, "403 Forbidden", true);
                 return;
         case ENOENT:
-                mog_http_resp(http, "404 Not Found", true);
+                mog_http_resp(mfd, "404 Not Found", true);
                 return;
         }
         PRESERVE_ERRNO(do {
-                mog_http_resp(http, "500 Internal Server Error", true);
+                mog_http_resp(mfd, "500 Internal Server Error", true);
         } while(0));
 }
 
@@ -288,7 +289,7 @@ retry:
 done:
         mog_file_close(http->forward);
         if (http->_p.persistent) {
-                mog_http_reset(http);
+                mog_http_reset(mfd);
                 return MOG_NEXT_ACTIVE;
         }
         return MOG_NEXT_CLOSE;