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.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/http_get.c b/http_get.c
index 98735f0..acca0df 100644
--- a/http_get.c
+++ b/http_get.c
@@ -48,7 +48,7 @@ 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;
+        char *buf;
         size_t len;
         struct mog_now *now = mog_now();
         long long count;
@@ -56,7 +56,7 @@ static off_t http_get_resp_hdr(struct mog_fd *mfd, struct stat *sb)
 
         /* single buffer so we can use MSG_MORE */
         buf = mog_fsbuf_get(&len);
-        modified = (char *)buf + len / 2;
+        modified = buf + len / 2;
         assert((len / 2) > MOG_HTTPDATE_CAPA && "fsbuf too small");
         mog_http_date(modified, MOG_HTTPDATE_CAPA, &sb->st_mtime);
 
@@ -174,6 +174,8 @@ bad_range:
         if (http->_p.http_method == MOG_HTTP_METHOD_HEAD)
                 count = 0;
 
+
+        TRACE(CMOGSTORED_HTTP_RES_START(mfd->fd, buf + sizeof("HTTP/1.1")));
         http->wbuf = mog_trysend(mfd->fd, buf, len, (off_t)count);
 
         return (off_t)count;
@@ -191,6 +193,9 @@ void mog_http_get_open(struct mog_fd *mfd, char *buf)
         assert(http->forward == NULL && "already have http->forward");
         assert(path[0] == '/' && "bad path");
 
+        TRACE(CMOGSTORED_HTTP_REQ_START(mfd->fd,
+                http->_p.http_method == MOG_HTTP_METHOD_HEAD ?
+                "HEAD" : "GET", path));
         if (path[1] == '\0') { /* keep "mogadm check" happy */
                 sb.st_mtime = 0;
                 sb.st_size = 0;
@@ -284,6 +289,7 @@ retry:
                        (long long)file->foff);
         }
 done:
+        TRACE(CMOGSTORED_HTTP_BYTES_XFER(mfd->fd, file->foff));
         mog_file_close(http->forward);
         if (http->_p.persistent) {
                 mog_http_reset(mfd);