~ubuntu-branches/ubuntu/jaunty/nginx/jaunty

« back to all changes in this revision

Viewing changes to src/http/ngx_http_core_module.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Hahler
  • Date: 2009-02-20 21:01:23 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20090220210123-7831awcjo5x7w6p7
Tags: 0.6.35-0ubuntu1
New upstream bugfix release

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
 
31
31
static ngx_int_t ngx_http_core_find_location(ngx_http_request_t *r,
32
32
    ngx_array_t *locations, ngx_uint_t regex_start, size_t len);
33
 
static ngx_int_t ngx_http_core_send_continue(ngx_http_request_t *r);
34
33
 
35
34
static ngx_int_t ngx_http_core_preconfiguration(ngx_conf_t *cf);
36
35
static void *ngx_http_core_create_main_conf(ngx_conf_t *cf);
786
785
{
787
786
    u_char                    *p;
788
787
    size_t                     len;
789
 
    ngx_int_t                  rc, expect;
 
788
    ngx_int_t                  rc;
790
789
    ngx_http_core_loc_conf_t  *clcf;
791
790
    ngx_http_core_srv_conf_t  *cscf;
792
791
 
833
832
        return NGX_OK;
834
833
    }
835
834
 
836
 
    if (r->headers_in.expect) {
837
 
        expect = ngx_http_core_send_continue(r);
838
 
 
839
 
        if (expect != NGX_OK) {
840
 
            ngx_http_finalize_request(r, expect);
841
 
            return NGX_OK;
842
 
        }
843
 
    }
844
 
 
845
835
    if (rc == NGX_HTTP_LOCATION_AUTO_REDIRECT) {
846
836
        r->headers_out.location = ngx_list_push(&r->headers_out.headers);
847
837
        if (r->headers_out.location == NULL) {
1261
1251
}
1262
1252
 
1263
1253
 
1264
 
static ngx_int_t
1265
 
ngx_http_core_send_continue(ngx_http_request_t *r)
1266
 
{
1267
 
    ngx_int_t   n;
1268
 
    ngx_str_t  *expect;
1269
 
 
1270
 
    if (r->expect_tested) {
1271
 
        return NGX_OK;
1272
 
    }
1273
 
 
1274
 
    r->expect_tested = 1;
1275
 
 
1276
 
    expect = &r->headers_in.expect->value;
1277
 
 
1278
 
    if (expect->len != sizeof("100-continue") - 1
1279
 
        || ngx_strncasecmp(expect->data, (u_char *) "100-continue",
1280
 
                           sizeof("100-continue") - 1)
1281
 
           != 0)
1282
 
    {
1283
 
        return NGX_OK;
1284
 
    }
1285
 
 
1286
 
    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
1287
 
                   "send 100 Continue");
1288
 
 
1289
 
    n = r->connection->send(r->connection,
1290
 
                            (u_char *) "HTTP/1.1 100 Continue" CRLF CRLF,
1291
 
                            sizeof("HTTP/1.1 100 Continue" CRLF CRLF) - 1);
1292
 
 
1293
 
    if (n == sizeof("HTTP/1.1 100 Continue" CRLF CRLF) - 1) {
1294
 
        return NGX_OK;
1295
 
    }
1296
 
 
1297
 
    /* we assume that such small packet should be send successfully */
1298
 
 
1299
 
    return NGX_HTTP_INTERNAL_SERVER_ERROR;
1300
 
}
1301
 
 
1302
 
 
1303
1254
ngx_int_t
1304
1255
ngx_http_set_content_type(ngx_http_request_t *r)
1305
1256
{
1861
1812
    sr->fast_subrequest = 1;
1862
1813
 
1863
1814
    sr->discard_body = r->discard_body;
 
1815
    sr->expect_tested = 1;
1864
1816
    sr->main_filter_need_in_memory = r->main_filter_need_in_memory;
1865
1817
 
1866
1818
    sr->uri_changes = NGX_HTTP_MAX_URI_CHANGES + 1;