//Process GET&HEAD header for response void http_header(char* writebuf, int writebuf_size, FILE *resource, HTTPResponse* response) { char* buf = writebuf; char mime[20]; char date[500]; char LastModified[500]; long int size; get_mime_type(mime, response->path); get_date(date, sizeof(date)); fseek(resource, 0L, SEEK_END); size = ftell(resource); fseek(resource, 0L, SEEK_SET); get_last_modified(LastModified, sizeof(LastModified), response); strcpy(buf, "HTTP/1.1 200 OK\r\n"); sprintf(buf+strlen(buf), "Date: %s\r\n", date); strcat(buf, SERVER_STRING); sprintf(buf+strlen(buf), "Last-Modified: %s\r\n", LastModified); strcat(buf, "Connection: close\r\n"); sprintf(buf+strlen(buf), "Content-Type: %s\r\n", mime); sprintf(buf+strlen(buf), "Content-Length: %ld\r\n", size); strcat(buf, "\r\n"); if(!strcasecmp(response->method, "GET")) response->file_size = size; response->file = resource; response->header_size = strlen(buf); response->write_byte += strlen(buf); }
static void objects_modified_cb (GObject *object, const GSList *objects, gpointer data) { const GSList *l; GMainLoop *loop = (GMainLoop *) data; for (l = objects; l; l = l->next) { icalcomponent *component = l->data; struct icaltimetype recurrence = icalcomponent_get_recurrenceid (component); struct icaltimetype last_modified = get_last_modified (component); g_print ( "Object modified %s (recurrence id:%s, last-modified:%s)\n", icalcomponent_get_uid (component), icaltime_as_ical_string (recurrence), icaltime_as_ical_string (last_modified)); g_assert (icalcomponent_get_summary (component) == NULL); } subtest_passed (SUBTEST_OBJECTS_MODIFIED, loop); }