second try, still with errors on HTTPPost

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

second try, still with errors on HTTPPost

EstebanLM
Hi,
I dug at the HTTPPost test and rewrote the http post as follow:


        | requestStream post |
        requestStream := HyCharWriteStream on: (WriteStream on: ByteArray new).
        requestStream
                nextPutLine: 'POST /api/v2/auth_info HTTP/1.1';
                nextPutLine: 'Host: localhost:33300';
                nextPutLine: 'Content-Type: application/x-www-form-urlencoded';
                nextPutLine: 'Content-Length: 105';
                crlf;
                nextPutLine: 'apiKey=bd5fac882006c2510c246fcc10a51e935952b4e9&token=f47c5a1701409cbb7f22fa361ca5b3ccd2c13884&format=xml'.
        post := HTTPRequest readFrom: (HyOctetReadStream onStream: (ReadStream on: requestStream octetStream contents)).
         (HyHTTPClient forRequest: post) response messageBody entityBody asString.

(note: localhost:33300 does a redirect to https://rpxnow.com)

...and now I'm having a "The object nil was not of the expected class String" :(



Reply | Threaded
Open this post in threaded view
|

Re: second try, still with errors on HTTPPost

Dale Henrichs
Esteban,

a stack for that error would be helpful ...

this is beginning to sound like a bug...

Dale

Esteban Lorenzano wrote:

> Hi,
> I dug at the HTTPPost test and rewrote the http post as follow:
>
>
> | requestStream post |
> requestStream := HyCharWriteStream on: (WriteStream on: ByteArray new).
> requestStream
> nextPutLine: 'POST /api/v2/auth_info HTTP/1.1';
> nextPutLine: 'Host: localhost:33300';
> nextPutLine: 'Content-Type: application/x-www-form-urlencoded';
> nextPutLine: 'Content-Length: 105';
> crlf;
> nextPutLine: 'apiKey=bd5fac882006c2510c246fcc10a51e935952b4e9&token=f47c5a1701409cbb7f22fa361ca5b3ccd2c13884&format=xml'.
> post := HTTPRequest readFrom: (HyOctetReadStream onStream: (ReadStream on: requestStream octetStream contents)).
> (HyHTTPClient forRequest: post) response messageBody entityBody asString.
>
> (note: localhost:33300 does a redirect to https://rpxnow.com)
>
> ...and now I'm having a "The object nil was not of the expected class String" :(
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: second try, still with errors on HTTPPost

EstebanLM
Thanks Dale,
I added host info to POST line... and that seems to be making the request (although I think that info should not be necessary (but i'm not sure about this)).

        |  requestStream post |
        requestStream := HyCharWriteStream on: (WriteStream on: ByteArray new).
        requestStream
                nextPutLine: 'POST 127.0.0.1:33300/api/v2/auth_info HTTP/1.1';
                nextPutLine: 'Host: 127.0.0.1:33300';
                nextPutLine: 'Content-Type: application/x-www-form-urlencoded';
                nextPutLine: 'Content-Length: 105';
                crlf;
                nextPutLine: 'apiKey=bd5fac882006c2510c246fcc10a51e935952b4e9&token=f47c5a1701409cbb7f22fa361ca5b3ccd2c13884&format=xml'.
        post := HTTPRequest readFrom: (HyOctetReadStream onStream: (ReadStream on: requestStream octetStream contents)).
        (HyHTTPClient forRequest: post) response.


Now, I'm getting a timeout error on reading response.
I tried to "copy stack", but it raised an error, so I'm sending a print screen with the stack info...

Cheers,
Esteban

 


El 28/06/2010, a las 4:24p.m., Dale Henrichs escribió:

> Esteban,
>
> a stack for that error would be helpful ...
>
> this is beginning to sound like a bug...
>
> Dale
>
> Esteban Lorenzano wrote:
>> Hi, I dug at the HTTPPost test and rewrote the http post as follow: | requestStream post |
>> requestStream := HyCharWriteStream on: (WriteStream on: ByteArray new).
>> requestStream
>> nextPutLine: 'POST /api/v2/auth_info HTTP/1.1';
>> nextPutLine: 'Host: localhost:33300';
>> nextPutLine: 'Content-Type: application/x-www-form-urlencoded';
>> nextPutLine: 'Content-Length: 105';
>> crlf;
>> nextPutLine: 'apiKey=bd5fac882006c2510c246fcc10a51e935952b4e9&token=f47c5a1701409cbb7f22fa361ca5b3ccd2c13884&format=xml'.
>> post := HTTPRequest readFrom: (HyOctetReadStream onStream: (ReadStream on: requestStream octetStream contents)).
>> (HyHTTPClient forRequest: post) response messageBody entityBody asString.
>> (note: localhost:33300 does a redirect to https://rpxnow.com)
>> ...and now I'm having a "The object nil was not of the expected class String" :(


Captura de pantalla 2010-06-28 a las 16.44.11.png (79K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: second try, still with errors on HTTPPost

Dale Henrichs
Esteban,

Sorry that it took a while to get back to you, but from the stack and
the timeout it looks like the response is hung because there is nothing
returned from the server ... it would be interesting to see if there
were anything in the buffer that is being filled...

Dale

Esteban Lorenzano wrote:

> Thanks Dale,
> I added host info to POST line... and that seems to be making the request (although I think that info should not be necessary (but i'm not sure about this)).
>
> |  requestStream post |
> requestStream := HyCharWriteStream on: (WriteStream on: ByteArray new).
> requestStream
> nextPutLine: 'POST 127.0.0.1:33300/api/v2/auth_info HTTP/1.1';
> nextPutLine: 'Host: 127.0.0.1:33300';
> nextPutLine: 'Content-Type: application/x-www-form-urlencoded';
> nextPutLine: 'Content-Length: 105';
> crlf;
> nextPutLine: 'apiKey=bd5fac882006c2510c246fcc10a51e935952b4e9&token=f47c5a1701409cbb7f22fa361ca5b3ccd2c13884&format=xml'.
> post := HTTPRequest readFrom: (HyOctetReadStream onStream: (ReadStream on: requestStream octetStream contents)).
> (HyHTTPClient forRequest: post) response.
>
>
> Now, I'm getting a timeout error on reading response.
> I tried to "copy stack", but it raised an error, so I'm sending a print screen with the stack info...
>
> Cheers,
> Esteban
>
>  
>
>
> ------------------------------------------------------------------------
>
Reply | Threaded
Open this post in threaded view
|

Re: second try, still with errors on HTTPPost

SeanTAllen
In reply to this post by EstebanLM
Do you get content back if you hit the url directly with curl etc?

On Mon, Jun 28, 2010 at 3:44 PM, Esteban Lorenzano <[hidden email]> wrote:

> Thanks Dale,
> I added host info to POST line... and that seems to be making the request (although I think that info should not be necessary (but i'm not sure about this)).
>
>        |  requestStream post |
>        requestStream := HyCharWriteStream on: (WriteStream on: ByteArray new).
>        requestStream
>                nextPutLine: 'POST 127.0.0.1:33300/api/v2/auth_info HTTP/1.1';
>                nextPutLine: 'Host: 127.0.0.1:33300';
>                nextPutLine: 'Content-Type: application/x-www-form-urlencoded';
>                nextPutLine: 'Content-Length: 105';
>                crlf;
>                nextPutLine: 'apiKey=bd5fac882006c2510c246fcc10a51e935952b4e9&token=f47c5a1701409cbb7f22fa361ca5b3ccd2c13884&format=xml'.
>        post := HTTPRequest readFrom: (HyOctetReadStream onStream: (ReadStream on: requestStream octetStream contents)).
>        (HyHTTPClient forRequest: post) response.
>
>
> Now, I'm getting a timeout error on reading response.
> I tried to "copy stack", but it raised an error, so I'm sending a print screen with the stack info...
>
> Cheers,
> Esteban
>
>
>
>
> El 28/06/2010, a las 4:24p.m., Dale Henrichs escribió:
>
>> Esteban,
>>
>> a stack for that error would be helpful ...
>>
>> this is beginning to sound like a bug...
>>
>> Dale
>>
>> Esteban Lorenzano wrote:
>>> Hi, I dug at the HTTPPost test and rewrote the http post as follow:  | requestStream post |
>>>      requestStream := HyCharWriteStream on: (WriteStream on: ByteArray new).
>>>      requestStream
>>>              nextPutLine: 'POST /api/v2/auth_info HTTP/1.1';
>>>              nextPutLine: 'Host: localhost:33300';
>>>              nextPutLine: 'Content-Type: application/x-www-form-urlencoded';
>>>              nextPutLine: 'Content-Length: 105';
>>>              crlf;
>>>              nextPutLine: 'apiKey=bd5fac882006c2510c246fcc10a51e935952b4e9&token=f47c5a1701409cbb7f22fa361ca5b3ccd2c13884&format=xml'.
>>>      post := HTTPRequest readFrom: (HyOctetReadStream onStream: (ReadStream on: requestStream octetStream contents)).
>>>       (HyHTTPClient forRequest: post) response messageBody entityBody asString.
>>> (note: localhost:33300 does a redirect to https://rpxnow.com)
>>> ...and now I'm having a "The object nil was not of the expected class String" :(
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: second try, still with errors on HTTPPost

Dale Henrichs
In reply to this post by EstebanLM

Esteban,

I looked a little closer at HTTPPost and it looks like it was not
completely implemented (for writing). The post data was  not being
dumped out as part of the request, so it is likely that the server was
still waiting for the content, too.

I've attached a filein with a patch that should work for your example
and submitted Issue 133
(http://code.google.com/p/glassdb/issues/detail?id=133) to track the
issue...

Dale

Esteban Lorenzano wrote:

> Thanks Dale,
> I added host info to POST line... and that seems to be making the request (although I think that info should not be necessary (but i'm not sure about this)).
>
> |  requestStream post |
> requestStream := HyCharWriteStream on: (WriteStream on: ByteArray new).
> requestStream
> nextPutLine: 'POST 127.0.0.1:33300/api/v2/auth_info HTTP/1.1';
> nextPutLine: 'Host: 127.0.0.1:33300';
> nextPutLine: 'Content-Type: application/x-www-form-urlencoded';
> nextPutLine: 'Content-Length: 105';
> crlf;
> nextPutLine: 'apiKey=bd5fac882006c2510c246fcc10a51e935952b4e9&token=f47c5a1701409cbb7f22fa361ca5b3ccd2c13884&format=xml'.
> post := HTTPRequest readFrom: (HyOctetReadStream onStream: (ReadStream on: requestStream octetStream contents)).
> (HyHTTPClient forRequest: post) response.
>
>
> Now, I'm getting a timeout error on reading response.
> I tried to "copy stack", but it raised an error, so I'm sending a print screen with the stack info...
>
> Cheers,
> Esteban
>
>  
>
>
> ------------------------------------------------------------------------
>

category: 'services-emitting'
method: HTTPPost
writeEntityTo: anOctetStream

        | keyCount count |
        keyCount := self messageBody keys size.
        count := 0.
        self messageBody postKeysAndValuesDo: [:key :value |
                anOctetStream
                        nextPutAll: key asByteArray;
                        nextPutAll: '=' asByteArray;
                        nextPutAll: value value asByteArray.
                        count := count + 1.
                        count < keyCount ifTrue: [ anOctetStream nextPutAll: '&' asByteArray ]].
        self entityBody == nil ifTrue: [ ^ self ].
        anOctetStream nextPutAll: self entityBody asByteArray.
%
Reply | Threaded
Open this post in threaded view
|

Re: second try, still with errors on HTTPPost

EstebanLM
Hi,
yes... it is working as expected using a pharo image, my problems were when uploading to glass. Btw, I managed to workaround the problem by changing the method I sent first. I can't send the method because of the mail I just send (he he). But as soon as I get the backup, I'll send the changed method to the list.

Cheers,
Esteban


El 30/06/2010, a las 2:31p.m., Dale Henrichs escribió:

>
> Esteban,
>
> I looked a little closer at HTTPPost and it looks like it was not completely implemented (for writing). The post data was  not being dumped out as part of the request, so it is likely that the server was still waiting for the content, too.
>
> I've attached a filein with a patch that should work for your example and submitted Issue 133 (http://code.google.com/p/glassdb/issues/detail?id=133) to track the issue...
>
> Dale
>
> Esteban Lorenzano wrote:
>> Thanks Dale,
>> I added host info to POST line... and that seems to be making the request (although I think that info should not be necessary (but i'm not sure about this)). |  requestStream post |
>> requestStream := HyCharWriteStream on: (WriteStream on: ByteArray new).
>> requestStream
>> nextPutLine: 'POST 127.0.0.1:33300/api/v2/auth_info HTTP/1.1';
>> nextPutLine: 'Host: 127.0.0.1:33300';
>> nextPutLine: 'Content-Type: application/x-www-form-urlencoded';
>> nextPutLine: 'Content-Length: 105';
>> crlf;
>> nextPutLine: 'apiKey=bd5fac882006c2510c246fcc10a51e935952b4e9&token=f47c5a1701409cbb7f22fa361ca5b3ccd2c13884&format=xml'.
>> post := HTTPRequest readFrom: (HyOctetReadStream onStream: (ReadStream on: requestStream octetStream contents)).
>> (HyHTTPClient forRequest: post) response.
>> Now, I'm getting a timeout error on reading response. I tried to "copy stack", but it raised an error, so I'm sending a print screen with the stack info...
>> Cheers, Esteban
>> ------------------------------------------------------------------------
> category: 'services-emitting'
> method: HTTPPost
> writeEntityTo: anOctetStream
>
> | keyCount count |
> keyCount := self messageBody keys size.
> count := 0.
> self messageBody postKeysAndValuesDo: [:key :value |
> anOctetStream
> nextPutAll: key asByteArray;
> nextPutAll: '=' asByteArray;
> nextPutAll: value value asByteArray.
> count := count + 1.
> count < keyCount ifTrue: [ anOctetStream nextPutAll: '&' asByteArray ]].
> self entityBody == nil ifTrue: [ ^ self ].
> anOctetStream nextPutAll: self entityBody asByteArray.
> %

Reply | Threaded
Open this post in threaded view
|

Re: second try, still with errors on HTTPPost

Monty Williams-3
Hi Estaban,

I just emailed you an emergency keyfile. It should allow you to clean up
your repo.

-- Monty

On 06/30/2010 11:07 AM, Esteban Lorenzano wrote:

> Hi,
> yes... it is working as expected using a pharo image, my problems were when uploading to glass. Btw, I managed to workaround the problem by changing the method I sent first. I can't send the method because of the mail I just send (he he). But as soon as I get the backup, I'll send the changed method to the list.
>
> Cheers,
> Esteban
>
>
> El 30/06/2010, a las 2:31p.m., Dale Henrichs escribió:
>
>    
>> Esteban,
>>
>> I looked a little closer at HTTPPost and it looks like it was not completely implemented (for writing). The post data was  not being dumped out as part of the request, so it is likely that the server was still waiting for the content, too.
>>
>> I've attached a filein with a patch that should work for your example and submitted Issue 133 (http://code.google.com/p/glassdb/issues/detail?id=133) to track the issue...
>>
>> Dale
>>
>> Esteban Lorenzano wrote:
>>      
>>> Thanks Dale,
>>> I added host info to POST line... and that seems to be making the request (although I think that info should not be necessary (but i'm not sure about this)). |  requestStream post |
>>> requestStream := HyCharWriteStream on: (WriteStream on: ByteArray new).
>>> requestStream
>>> nextPutLine: 'POST 127.0.0.1:33300/api/v2/auth_info HTTP/1.1';
>>> nextPutLine: 'Host: 127.0.0.1:33300';
>>> nextPutLine: 'Content-Type: application/x-www-form-urlencoded';
>>> nextPutLine: 'Content-Length: 105';
>>> crlf;
>>> nextPutLine: 'apiKey=bd5fac882006c2510c246fcc10a51e935952b4e9&token=f47c5a1701409cbb7f22fa361ca5b3ccd2c13884&format=xml'.
>>> post := HTTPRequest readFrom: (HyOctetReadStream onStream: (ReadStream on: requestStream octetStream contents)).
>>> (HyHTTPClient forRequest: post) response.
>>> Now, I'm getting a timeout error on reading response. I tried to "copy stack", but it raised an error, so I'm sending a print screen with the stack info...
>>> Cheers, Esteban
>>> ------------------------------------------------------------------------
>>>        
>> category: 'services-emitting'
>> method: HTTPPost
>> writeEntityTo: anOctetStream
>>
>> | keyCount count |
>> keyCount := self messageBody keys size.
>> count := 0.
>> self messageBody postKeysAndValuesDo: [:key :value |
>> anOctetStream
>> nextPutAll: key asByteArray;
>> nextPutAll: '=' asByteArray;
>> nextPutAll: value value asByteArray.
>> count := count + 1.
>> count<  keyCount ifTrue: [ anOctetStream nextPutAll: '&' asByteArray ]].
>> self entityBody == nil ifTrue: [ ^ self ].
>> anOctetStream nextPutAll: self entityBody asByteArray.
>> %
>>      
>    


--
Monty Williams
Director, Product Marketing, R&D
VMware
+1 503 533-3506 (office)
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: second try, still with errors on HTTPPost

Dale Henrichs
In reply to this post by EstebanLM
Esteban,

I'm glad you were able to work around the problem ... I saw that Monty
responded to your $GB limit problem ... I lost my wifi connection for a
while and walked the dogs:) and just got back online:) I'll wait to see
your patch when you get a chance.

Dale

Esteban Lorenzano wrote:

> Hi,
> yes... it is working as expected using a pharo image, my problems were when uploading to glass. Btw, I managed to workaround the problem by changing the method I sent first. I can't send the method because of the mail I just send (he he). But as soon as I get the backup, I'll send the changed method to the list.
>
> Cheers,
> Esteban
>
>
> El 30/06/2010, a las 2:31p.m., Dale Henrichs escribió:
>
>> Esteban,
>>
>> I looked a little closer at HTTPPost and it looks like it was not completely implemented (for writing). The post data was  not being dumped out as part of the request, so it is likely that the server was still waiting for the content, too.
>>
>> I've attached a filein with a patch that should work for your example and submitted Issue 133 (http://code.google.com/p/glassdb/issues/detail?id=133) to track the issue...
>>
>> Dale
>>
>> Esteban Lorenzano wrote:
>>> Thanks Dale,
>>> I added host info to POST line... and that seems to be making the request (although I think that info should not be necessary (but i'm not sure about this)). |  requestStream post |
>>> requestStream := HyCharWriteStream on: (WriteStream on: ByteArray new).
>>> requestStream
>>> nextPutLine: 'POST 127.0.0.1:33300/api/v2/auth_info HTTP/1.1';
>>> nextPutLine: 'Host: 127.0.0.1:33300';
>>> nextPutLine: 'Content-Type: application/x-www-form-urlencoded';
>>> nextPutLine: 'Content-Length: 105';
>>> crlf;
>>> nextPutLine: 'apiKey=bd5fac882006c2510c246fcc10a51e935952b4e9&token=f47c5a1701409cbb7f22fa361ca5b3ccd2c13884&format=xml'.
>>> post := HTTPRequest readFrom: (HyOctetReadStream onStream: (ReadStream on: requestStream octetStream contents)).
>>> (HyHTTPClient forRequest: post) response.
>>> Now, I'm getting a timeout error on reading response. I tried to "copy stack", but it raised an error, so I'm sending a print screen with the stack info...
>>> Cheers, Esteban
>>> ------------------------------------------------------------------------
>> category: 'services-emitting'
>> method: HTTPPost
>> writeEntityTo: anOctetStream
>>
>> | keyCount count |
>> keyCount := self messageBody keys size.
>> count := 0.
>> self messageBody postKeysAndValuesDo: [:key :value |
>> anOctetStream
>> nextPutAll: key asByteArray;
>> nextPutAll: '=' asByteArray;
>> nextPutAll: value value asByteArray.
>> count := count + 1.
>> count < keyCount ifTrue: [ anOctetStream nextPutAll: '&' asByteArray ]].
>> self entityBody == nil ifTrue: [ ^ self ].
>> anOctetStream nextPutAll: self entityBody asByteArray.
>> %
>