Giter Club home page Giter Club logo

Comments (8)

brunoos avatar brunoos commented on July 24, 2024

Nothing here... is there some more info?

$ luajit test.lua
nil closed nil nil


$ luarocks help
LuaRocks 2.2.2, a module deployment system for Lua

$ luarocks list
luasec
0.5-2 (installed) - /home/brunoos/local/rocks-5.1/lib/luarocks/rocks
luasocket
3.0rc1-2 (installed) - /home/brunoos/local/rocks-5.1/lib/luarocks/rocks

$ luajit -v
LuaJIT 2.0.4 -- Copyright (C) 2005-2015 Mike Pall. http://luajit.org/

$ openssl version
OpenSSL 1.0.1l-freebsd 15 Jan 2015

$ uname -a
FreeBSD freebsd10 10.1-RELEASE-p10 FreeBSD 10.1-RELEASE-p10 #0: Wed May 13 06:54:13 UTC 2015 [email protected]:/usr/obj/usr/src/sys/GENERIC amd64

from luasec.

moritzbuhl avatar moritzbuhl commented on July 24, 2024

What could I try? What info can I give you?

from luasec.

brunoos avatar brunoos commented on July 24, 2024

Did you compile "luajit" yourself?

from luasec.

moritzbuhl avatar moritzbuhl commented on July 24, 2024

I installed it with pkg.

from luasec.

moritzbuhl avatar moritzbuhl commented on July 24, 2024

I get the same problem when installing luajit from ports.

lua51 test.lua 
nil closed  nil nil

this works. So is it an error in Luajit?

And I don't think that the values should be nil.

from luasec.

brunoos avatar brunoos commented on July 24, 2024

The problem is the automatic redirection from socket.http. It tries to connect on port 80, but it is https.

$ lua test.lua
301 HTTP/1.1 301 Moved Permanently
redirect https://de.wiktionary.org/wiki/%26
path /wiki/%26
create function: 0x7fb94b430cd0
authority de.wiktionary.org
host de.wiktionary.org
port 80
nredirects 1
scheme https
url https://de.wiktionary.org/wiki/%26
uri /wiki/&
headers table: 0x7fb94b42e3d0

We know the issue, but we need some commits on luasocket to address it.

However, Firefox does not receive a 301 code from the site. Using firebug I noticed that Firefox send "/wiki/%26" as request, but luasocket send "/wiki/&", i.e., it unescape the URL.

Typing "https://de.wiktionary.org/wiki/&" on Firefox, I received a 301 also.

If I force socket.http to request "/wiki/%26" it works fine.

So, even if you turn off auto-redirect, you still have problem in the request.

(?)

from luasec.

moritzbuhl avatar moritzbuhl commented on July 24, 2024

If I force socket.http to request "/wiki/%26" it works fine.
How do I do that?

And is there an issue in the luasocket reposetory already?

from luasec.

brunoos avatar brunoos commented on July 24, 2024

In this case, edit socket/url.lua and remove "&" from the list of unescaped.

-- these are allowed withing a path segment, along with alphanum
-- other characters must be escaped
local segment_set = make_set {
    "-", "_", ".", "!", "~", "*", "'", "(",
--    ")", ":", "@", "&", "=", "+", "$", ",",
    ")", ":", "@", "=", "+", "$", ",",
}

Do not ask me what it could happen with other URLs.

Tieske already submit a PR.

from luasec.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.