/[hydra]/hydra/src/response.c
ViewVC logotype

Diff of /hydra/src/response.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8 by nmav, Sat Sep 28 16:32:37 2002 UTC revision 1.9 by nmav, Sun Sep 29 11:00:04 2002 UTC
# Line 66  void print_last_modified(request * req) Line 66  void print_last_modified(request * req)
66      req_write(req, lm);      req_write(req, lm);
67  }  }
68    
69    void print_etag(request * req)
70    {
71    char buffer[sizeof("ETag: \"\"-\r\n") + MAX_ETAG_LENGTH + 3];
72    
73        sprintf( buffer, "ETag: \"%lu-%lu\"\r\n", req->last_modified % 10000,
74            req->filesize % 10000);
75        /* mod 10000 is used to allow no more than 4 characters -- max is 9999
76         */
77        req_write(req, buffer);
78    }
79    
80  void print_ka_phrase(request * req)  void print_ka_phrase(request * req)
81  {  {
82    
# Line 132  void send_r_request_ok(request * req) Line 143  void send_r_request_ok(request * req)
143      if (!req->is_cgi) {      if (!req->is_cgi) {
144          print_content_length(req);          print_content_length(req);
145          print_last_modified(req);          print_last_modified(req);
146            print_etag(req);
147          print_content_type(req);          print_content_type(req);
148          req_write(req, "\r\n");          req_write(req, "\r\n");
149      }      }
# Line 301  void send_r_not_found(request * req) Line 313  void send_r_not_found(request * req)
313      req_flush(req);      req_flush(req);
314  }  }
315    
316    /* R_PRECONDITION_FAILED: 412 */
317    void send_r_precondition_failed(request * req)
318    {
319        req->response_status = R_PRECONDITION_FAILED;
320        if (req->simple)
321            return;
322    
323        if (!req->simple) {
324            req_write(req, HTTP_VERSION" 412 Precondition Failed\r\n");
325            print_http_headers(req);
326            req_write(req, "Content-Type: " TEXT_HTML "\r\n\r\n"); /* terminate header */
327        }
328        if (req->method != M_HEAD) {
329            req_write(req, "<HTML><HEAD><TITLE>412 Precondition Failed</TITLE></HEAD>\n"
330                      "<BODY><H1>412 Precondition failed</H1>\n");
331    
332            req_write(req, "</BODY></HTML>\n");
333        }
334        req_flush(req);
335    }
336    
337  /* R_RANGE_UNSATISFIABLE: 416 */  /* R_RANGE_UNSATISFIABLE: 416 */
338  void send_r_range_unsatisfiable(request * req)  void send_r_range_unsatisfiable(request * req)
339  {  {
# Line 330  void send_r_range_unsatisfiable(request Line 363  void send_r_range_unsatisfiable(request
363      req_flush(req);      req_flush(req);
364  }  }
365    
   
366  /* R_ERROR: 500 */  /* R_ERROR: 500 */
367  void send_r_error(request * req)  void send_r_error(request * req)
368  {  {

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26