Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / Программирование [игнор отключен] [закрыт для гостей] / HTTP запросы / 9 сообщений из 9, страница 1 из 1
28.04.2005, 16:19
    #33041003
kAlexander
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
HTTP запросы
Но могу понять вот что:
шлю запрос:
CODE
POST /forum/index.php?act=Login&CODE=01 HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/msword, application/vnd.ms-excel, */*
Accept-Language: ru
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 1.0.3705)
Host: filmoskop.degunino.net:8080
Content-Length: 127
Connection: Keep-Alive
Cache-Control: no-cache

referer=http%3A%2F%2Ffilmoskop.degunino.net


А мне в ответ:
CODE
HTTP/1.1 400 Bad Request
Date: Thu, 28 Apr 2005 22:57:13 GMT
Server: Apache/1.3.12 (Win32)
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=iso-8859-1

188
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>400 Bad Request</TITLE>
</HEAD><BODY>
<H1>Bad Request</H1>
Your browser sent a request that this server could not understand.<P>
client sent HTTP/1.1 request without hostname (see RFC2068 section 9, and 14.23): /forum/index.php<P>
<HR>
<ADDRESS>Apache/1.3.12 Server at filmoskop.degunino.net Port 80</ADDRESS>
</BODY></HTML>

0


В чем проблема ?
Строки в запросе соединяю chr(10)+chr(13) (перевод строки, возврат каретки), если только перевод строки, то нет ответа вообще
...
Рейтинг: 0 / 0
28.04.2005, 16:37
    #33041066
heizer
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
HTTP запросы
вообще-то chr(13)+chr(10)

и почему POST? У Вас по-моему д.б. GET.
...
Рейтинг: 0 / 0
28.04.2005, 16:50
    #33041114
kAlexander
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
HTTP запросы
Если я использую chr(13)+chr(10), то сервер сообще ничего не отвечает.
А POST вроде потому, что передаю методом post.
По краёней мере мне так мой браузер прислал.
...
Рейтинг: 0 / 0
28.04.2005, 17:01
    #33041159
heizer
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
HTTP запросы
А если написать полностью (как он просит):

POST filmoskop.degunino.net/forum/index.php?act=Login&CODE=01 HTTP/1.1
...
Рейтинг: 0 / 0
28.04.2005, 17:09
    #33041193
kAlexander
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
HTTP запросы
Неа, тоже самое =(
HTTPHTTP/1.1 400 Bad Request
Date: Fri, 29 Apr 2005 00:10:30 GMT
Server: Apache/1.3.12 (Win32)
Connection: close
Transfer-Encoding: chunked
Content-Type: text/html; charset=iso-8859-1

19d
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML><HEAD>
<TITLE>400 Bad Request</TITLE>
</HEAD><BODY>
<H1>Bad Request</H1>
Your browser sent a request that this server could not understand.<P>
client sent HTTP/1.1 request without hostname (see RFC2068 section 9, and 14.23): filmoskop.degunino.net/forum/index.php<P>
<HR>
<ADDRESS>Apache/1.3.12 Server at filmoskop.degunino.net Port 80</ADDRESS>
</BODY></HTML>

0
...
Рейтинг: 0 / 0
28.04.2005, 17:28
    #33041262
kAlexander
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
HTTP запросы
Вот что он советует почитать:
9.5 POST The POST method is used to request that the destination server accept
the entity enclosed in the request as a new subordinate of the
resource identified by the Request-URI in the Request-Line. POST is
designed to allow a uniform method to cover the following functions:

o Annotation of existing resources;

o Posting a message to a bulletin board, newsgroup, mailing list,
or similar group of articles;

o Providing a block of data, such as the result of submitting a
form, to a data-handling process;

o Extending a database through an append operation.

The actual function performed by the POST method is determined by the
server and is usually dependent on the Request-URI. The posted entity
is subordinate to that URI in the same way that a file is subordinate
to a directory containing it, a news article is subordinate to a
newsgroup to which it is posted, or a record is subordinate to a
database.

The action performed by the POST method might not result in a
resource that can be identified by a URI. In this case, either 200
(OK) or 204 (No Content) is the appropriate response status,
depending on whether or not the response includes an entity that
describes the result.

If a resource has been created on the origin server, the response
SHOULD be 201 (Created) and contain an entity which describes the
status of the request and refers to the new resource, and a Location
header (see section 14.30).

Responses to this method are not cachable, unless the response
includes appropriate Cache-Control or Expires header fields. However,
the 303 (See Other) response can be used to direct the user agent to
retrieve a cachable resource.

POST requests must obey the message transmission requirements set out
in section 8.2.

14.23 HostThe Host request-header field specifies the Internet host and port
number of the resource being requested, as obtained from the original
URL given by the user or referring resource (generally an HTTP URL,
as described in section 3.2.2). The Host field value MUST represent
the network location of the origin server or gateway given by the
original URL. This allows the origin server or gateway to
differentiate between internally-ambiguous URLs, such as the root "/"
URL of a server for multiple host names on a single IP address.

Host = "Host" ":" host [ ":" port ] ; Section 3.2.2

A "host" without any trailing port information implies the default
port for the service requested (e.g., "80" for an HTTP URL). For
example, a request on the origin server for
<http://www.w3.org/pub/WWW/> MUST include:

GET /pub/WWW/ HTTP/1.1
Host: www.w3.org

A client MUST include a Host header field in all HTTP/1.1 request
messages on the Internet (i.e., on any message corresponding to a
request for a URL which includes an Internet host address for the
service being requested). If the Host field is not already present,
an HTTP/1.1 proxy MUST add a Host field to the request message prior
to forwarding it on the Internet. All Internet-based HTTP/1.1 servers
MUST respond with a 400 status code to any HTTP/1.1 request message
which lacks a Host header field.

See sections 5.2 and 19.5.1 for other requirements relating to Host.
...
Рейтинг: 0 / 0
28.04.2005, 21:31
    #33041763
heizer
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
HTTP запросы
Вот html для входа в мой ящик MyPostBox@yandex.ru на Яндексе:
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
<html>
<body>
<form name="form1" method="post" action=
"http://passport.yandex.ru/cgi-
bin/Reg.pl?mode=auth&retpath=http://narod.yandex.ru/userarea/
after_register.xhtml">
<input type="password" name="login" value="MyPostBox">
<input type="password" name="passwd" value="MyBestPassword">
<input type="submit" name="imageField">
</form>
</body>
</html>

Перехватываем сабмит и смотрим, что он пересылает на веб-сервер Яндекса:

POST http://passport.yandex.ru/cgi-bin/Reg.pl?mode=auth&retpath=http://narod.yandex.ru/userarea/after_register.xhtml HTTP/1.0

Accept: application/vnd.ms-excel, application/msword, image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*

Accept-Language: ru

Content-Type: application/x-www-form-urlencoded

Pragma: no-cache

User-Agent: Mozilla/4.0 (compatible; MSIE 6.2; Windows 2005)

Host: passport.yandex.ru

Content-Length: 89

Proxy-Connection: Keep-Alive



login=MyPostBox&passwd=MyBestPassword&imageField=%CF%EE%E4%E0%F7%E0+%E7%E0%EF%F0%EE%F1%E0


Все строки здесь разделены тремя байтами: 0D0D0A
А последняя строка отделена от предпоследней шестью байтами: 0D0D0A0D0D0A
И длина последней строки и есть Content-Length этого "поста", равный 89.

Зацениваем разницу с твоим вариантом и делаем выводы.
...
Рейтинг: 0 / 0
28.04.2005, 22:56
    #33041819
Green2
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
HTTP запросы
kAlexander ты что, браузер чтоли пишешь?

--

Posted via ActualForum NNTP Server 1.1
...
Рейтинг: 0 / 0
29.04.2005, 09:56
    #33042108
heizer
Гость
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
HTTP запросы
Действительно, что значит твоя загадочная фраза

"По краёней мере мне так мой браузер прислал." ???
...
Рейтинг: 0 / 0
Форумы / Программирование [игнор отключен] [закрыт для гостей] / HTTP запросы / 9 сообщений из 9, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]