zend_llist_init(&SG(sapi_headers).headers, sizeof(sapi_header_struct), (void (*)(void *)) sapi_free_header, 0);
SG(sapi_headers).send_default_content_type = 1;
+ /*
SG(sapi_headers).http_response_code = 200;
SG(sapi_headers).http_status_line = NULL;
+ */
SG(headers_sent) = 0;
SG(read_post_bytes) = 0;
SG(request_info).post_data = NULL;
SG(request_info).current_user = NULL;
SG(request_info).current_user_length = 0;
+#if 0
+ /* This can't be done here. We need to do that in the individual SAPI
+ * modules because you can actually have a GET request that is only
+ * allowed to send back headers.
+ */
if (SG(request_info).request_method && !strcmp(SG(request_info).request_method, "HEAD")) {
SG(request_info).headers_only = 1;
} else {
SG(request_info).headers_only = 0;
}
+#endif
if (SG(server_context)) {
if (SG(request_info).request_method
index = Ns_SetIFind(NSG(conn)->headers, "content-type");
SG(request_info).content_type = index == -1 ? NULL :
Ns_SetValue(NSG(conn)->headers, index);
+ if (!strcmp(NSG(conn)->request->method, "HEAD")) {
+ SG(request_info).headers_only = 1;
+ } else {
+ SG(request_info).headers_only = 0;
+ }
+ SG(sapi_headers).http_response_code = 200;
tmp = Ns_ConnAuthUser(NSG(conn));
if(tmp) {
SG(request_info).request_method = (char *)r->method;
SG(request_info).content_type = (char *) table_get(r->subprocess_env, "CONTENT_TYPE");
SG(request_info).content_length = (content_length ? atoi(content_length) : 0);
+ SG(request_info).headers_only = r->header_only;
+ SG(sapi_headers).http_response_code = r->status;
if (r->headers_in) {
authorization = table_get(r->headers_in, "Authorization");
SG(request_info).path_translated = NULL; /* we have to update it later, when we have that information */
SG(request_info).content_type = getenv("CONTENT_TYPE");
SG(request_info).content_length = (content_length?atoi(content_length):0);
-
+ SG(sapi_headers).http_response_code = 200;
+ if (SG(request_info).request_method && !strcmp(SG(request_info).request_method, "HEAD")) {
+ SG(request_info).headers_only = 1;
+ } else {
+ SG(request_info).headers_only = 0;
+ }
/* CGI does not support HTTP authentication */
SG(request_info).auth_user = NULL;
SG(request_info).auth_password = NULL;
SG(request_info).request_uri = lpECB->lpszPathInfo;
SG(request_info).content_type = lpECB->lpszContentType;
SG(request_info).content_length = lpECB->cbTotalBytes;
+ SG(sapi_headers).http_response_code = 200; /* I think dwHttpStatusCode is invalid at this stage -RL */
+ if (!strcmp(lpECB->lpszMethod, "HEAD")) {
+ SG(request_info).headers_only = 1;
+ } else {
+ SG(request_info).headers_only = 0;
+ }
{
char *path_end = strrchr(SG(request_info).path_translated, SEPARATOR);
SG(request_info).path_translated = nsapi_strdup(path_translated);
SG(request_info).content_type = nsapi_strdup(content_type);
SG(request_info).content_length = (content_length == NULL) ? 0 : strtoul(content_length, 0, 0);
+ SG(sapi_headers).http_response_code = 200;
+ if (!strcmp(request_method, "HEAD")) {
+ SG(request_info).headers_only = 1;
+ } else {
+ SG(request_info).headers_only = 0;
+ }
+
}
static void
SG(request_info).query_string = PHG(cip)->hip->request;
SG(request_info).request_method = PHG(cip)->hip->method;
SG(request_info).path_translated = malloc(MAXPATHLEN+1);
+ SG(sapi_headers).http_response_code = 200;
+ if (!strcmp(PHG(cip)->hip->method, "HEAD")) {
+ SG(request_info).headers_only = 1;
+ } else {
+ SG(request_info).headers_only = 0;
+ }
if (url_expand(PHG(cip)->hip->url, SG(request_info).path_translated, MAXPATHLEN, &PHG(sb), NULL, NULL) == NULL) {
/* handle error */
}
SG(request_info).content_length = lpCB->cbTotalBytes;
SG(request_info).auth_user = lpCB->lpszUser;
SG(request_info).auth_password = lpCB->lpszPassword;
+ SG(sapi_headers).http_response_code = 200;
+ if (!strcmp(lpCB->lpszMethod, "HEAD")) {
+ SG(request_info).headers_only = 1;
+ } else {
+ SG(request_info).headers_only = 0;
+ }
}
static void hash_pi3web_variables(ELS_D SLS_DC)
SG(request_info).request_method = lookup_string_header("REQUEST_METHOD", "GET");
SG(request_info).content_length = lookup_integer_header("HTTP_CONTENT_LENGTH", 0);
SG(request_info).content_type = lookup_string_header("HTTP_CONTENT_TYPE", NULL);
-
+ SG(sapi_headers).http_response_code = 200;
+ if (!strcmp(SG(request_info).request_method, "HEAD")) {
+ SG(request_info).headers_only = 1;
+ } else {
+ SG(request_info).headers_only = 0;
+ }
+
/* FIXME: Check for auth stuff needs to be fixed... */
SG(request_info).auth_user = NULL;
SG(request_info).auth_password = NULL;
SETSTRING( SG(request_info).query_string, queryString );
SETSTRING( SG(request_info).request_uri, requestURI );
SETSTRING( SG(request_info).content_type, contentType );
+ SG(sapi_headers).http_response_code = 200;
+ if (!strcmp(SG(request_info).request_method, "HEAD")) {
+ SG(request_info).headers_only = 1;
+ } else {
+ SG(request_info).headers_only = 1;
+ }
SG(request_info).content_length = contentLength;
SG(request_info).auth_password = NULL;
if (php_request_startup(CLS_C ELS_CC PLS_CC SLS_CC)==FAILURE) {
snprintf(buf, 1023, "/%s", TG(hc)->origfilename);
SG(request_info).request_uri = strdup(buf);
SG(request_info).request_method = httpd_method_str(TG(hc)->method);
-
+ if (!strcmp(SG(request_info).request_method, "HEAD")) {
+ SG(request_info).headers_only = 1;
+ } else {
+ SG(request_info).headers_only = 0;
+ }
+ SG(sapi_headers).http_response_code = 200;
SG(request_info).content_type = TG(hc)->contenttype;
SG(request_info).content_length = TG(hc)->contentlength;